@realsee/dnalogel 2.0.0-alpha.4 → 2.0.0-alpha.7

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 (106) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +44 -5
  3. package/dist/dnalogel.cjs.js +7 -2
  4. package/dist/dnalogel.es.js +3668 -184
  5. package/dist/dnalogel.umd.js +7 -2
  6. package/dist/style.css +1 -1
  7. package/libs/CSS3DRenderPlugin/index.js +1 -1
  8. package/libs/PanoCompassPlugin/Assets/roomInfoIcon.d.ts +1 -0
  9. package/libs/PanoCompassPlugin/Assets/roomInfoIcon.js +1 -0
  10. package/libs/PanoCompassPlugin/getRoomInfoInstance.d.ts +8 -0
  11. package/libs/PanoCompassPlugin/getRoomInfoInstance.js +48 -0
  12. package/libs/PanoCompassPlugin/index.d.ts +29 -3
  13. package/libs/PanoCompassPlugin/index.js +126 -44
  14. package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
  15. package/libs/PanoMeasurePlugin/Controller/BaseController.js +69 -0
  16. package/libs/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
  17. package/libs/PanoMeasurePlugin/Controller/EditController.js +216 -0
  18. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
  19. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +44 -0
  20. package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
  21. package/libs/PanoMeasurePlugin/Controller/WatchController.js +223 -0
  22. package/libs/PanoMeasurePlugin/Controller/index.d.ts +61 -0
  23. package/libs/PanoMeasurePlugin/Controller/index.js +176 -0
  24. package/libs/PanoMeasurePlugin/Model/index.d.ts +38 -0
  25. package/libs/PanoMeasurePlugin/Model/index.js +114 -0
  26. package/libs/PanoMeasurePlugin/Model/line.d.ts +30 -0
  27. package/libs/PanoMeasurePlugin/Model/line.js +64 -0
  28. package/libs/PanoMeasurePlugin/Model/point.d.ts +16 -0
  29. package/libs/PanoMeasurePlugin/Model/point.js +28 -0
  30. package/libs/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
  31. package/libs/PanoMeasurePlugin/Model/polyline.js +48 -0
  32. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
  33. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +15 -0
  34. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
  35. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +2 -0
  36. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
  37. package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +2 -0
  38. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
  39. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +108 -0
  40. package/libs/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
  41. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +33 -0
  42. package/libs/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
  43. package/libs/PanoMeasurePlugin/Modules/GuideController.js +75 -0
  44. package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
  45. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +103 -0
  46. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
  47. package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +117 -0
  48. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
  49. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +102 -0
  50. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
  51. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +35 -0
  52. package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
  53. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +69 -0
  54. package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
  55. package/libs/PanoMeasurePlugin/Modules/UIController/style.js +78 -0
  56. package/libs/PanoMeasurePlugin/index.d.ts +7 -0
  57. package/libs/PanoMeasurePlugin/index.js +5 -0
  58. package/libs/PanoMeasurePlugin/typings/data.d.ts +28 -0
  59. package/libs/PanoMeasurePlugin/typings/data.js +1 -0
  60. package/libs/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
  61. package/libs/PanoMeasurePlugin/typings/event.type.js +1 -0
  62. package/libs/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
  63. package/libs/PanoMeasurePlugin/typings/utils.type.js +1 -0
  64. package/libs/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
  65. package/libs/PanoMeasurePlugin/utils/clearGroup.js +3 -0
  66. package/libs/PanoMeasurePlugin/utils/constants.d.ts +4 -0
  67. package/libs/PanoMeasurePlugin/utils/constants.js +31 -0
  68. package/libs/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
  69. package/libs/PanoMeasurePlugin/utils/distanceDom.js +114 -0
  70. package/libs/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
  71. package/libs/PanoMeasurePlugin/utils/findAssociatedLines.js +21 -0
  72. package/libs/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
  73. package/libs/PanoMeasurePlugin/utils/findClosestPoint.js +27 -0
  74. package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
  75. package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +9 -0
  76. package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
  77. package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +14 -0
  78. package/libs/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
  79. package/libs/PanoMeasurePlugin/utils/ironbox.js +1 -0
  80. package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
  81. package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.js +6 -0
  82. package/libs/PanoMeasurePlugin/utils/line.d.ts +17 -0
  83. package/libs/PanoMeasurePlugin/utils/line.js +32 -0
  84. package/libs/PanoMeasurePlugin/utils/math.d.ts +17 -0
  85. package/libs/PanoMeasurePlugin/utils/math.js +44 -0
  86. package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
  87. package/libs/PanoMeasurePlugin/utils/mouseGroup.js +21 -0
  88. package/libs/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
  89. package/libs/PanoMeasurePlugin/utils/ndc2Screen.js +6 -0
  90. package/libs/PanoRulerPlugin/index.js +1 -0
  91. package/libs/PanoRulerPlugin/style.d.ts +1 -1
  92. package/libs/PanoRulerPlugin/style.js +1 -0
  93. package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.svelte +3 -3
  94. package/libs/floorplan/ModelFloorplanPlugin/Components/Camera.svelte.map +1 -1
  95. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +2 -0
  96. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +3 -1
  97. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +2 -0
  98. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +4 -3
  99. package/libs/floorplan/constant.d.ts +5 -0
  100. package/libs/floorplan/constant.js +6 -0
  101. package/libs/floorplan/typings/floorplanServerData.d.ts +4 -0
  102. package/libs/index.d.ts +4 -1
  103. package/libs/index.js +4 -1
  104. package/libs/shared-utils/getPxmm.d.ts +6 -1
  105. package/libs/shared-utils/getPxmm.js +26 -12
  106. package/package.json +2 -1
@@ -1,2 +1,7 @@
1
- var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three"),require("three/examples/jsm/renderers/CSS3DRenderer"),require("@realsee/five/line"),require("@realsee/five")):"function"==typeof define&&define.amd?define(["exports","three","three/examples/jsm/renderers/CSS3DRenderer","@realsee/five/line","@realsee/five"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dnalogel={},e.THREE,e.CSS3DRenderer,e.FiveSDK_Line,e.five)}(this,(function(e,t,n,r,i){"use strict";function a(e){if(e&&e.__esModule)return e;var t={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=a(t);function s(e,t){const n=Math.round(e);return n%2==0?n:n+Number((null==t?void 0:t.smaller)?-1:1)}const l=({x:e,y:n,z:r})=>new t.Vector3(e,n,r);function c(e,n,i=new t.Vector3(1,1,1),a=!1){const o=new r.Line(e,n);return o.setMaterial({dashed:a,color:i,linewidth:1}),o.remove(o.points),o}function h(){}const u=e=>e;function p(e,t){for(const n in t)e[n]=t[n];return e}function d(e){return e()}function f(){return Object.create(null)}function m(e){e.forEach(d)}function v(e){return"function"==typeof e}function g(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let y;function x(e,t){return y||(y=document.createElement("a")),y.href=t,e===y.href}const b="undefined"!=typeof window;let w=b?()=>window.performance.now():()=>Date.now(),_=b?e=>requestAnimationFrame(e):h;const M=new Set;function S(e){M.forEach((t=>{t.c(e)||(M.delete(t),t.f())})),0!==M.size&&_(S)}function E(e,t){e.appendChild(t)}function T(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function A(e){const t=R("style");return function(e,t){E(e.head||e,t)}(T(e),t),t.sheet}function P(e,t,n){e.insertBefore(t,n||null)}function L(e){e.parentNode.removeChild(e)}function R(e){return document.createElement(e)}function C(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function I(e){return document.createTextNode(e)}function D(){return I(" ")}function O(){return I("")}function N(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function F(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function z(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function U(e,t,n,r){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}let B;function k(e,t){"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=R("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const r=function(){if(void 0===B){B=!1;try{"undefined"!=typeof window&&window.parent&&window.parent.document}catch(e){B=!0}}return B}();let i;return r?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",i=N(window,"message",(e=>{e.source===n.contentWindow&&t()}))):(n.src="about:blank",n.onload=()=>{i=N(n.contentWindow,"resize",t)}),E(e,n),()=>{(r||i&&n.contentWindow)&&i(),L(n)}}function G(e,t,n){e.classList[n?"add":"remove"](t)}class H{constructor(){this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.e=R(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)P(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(L)}}const j=new Map;let V,W=0;function q(e,t,n,r,i,a,o,s=0){const l=16.666/r;let c="{\n";for(let v=0;v<=1;v+=l){const e=t+(n-t)*a(v);c+=100*v+`%{${o(e,1-e)}}\n`}const h=c+`100% {${o(n,1-n)}}\n}`,u=`__svelte_${function(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(h)}_${s}`,p=T(e),{stylesheet:d,rules:f}=j.get(p)||function(e,t){const n={stylesheet:A(t),rules:{}};return j.set(e,n),n}(p,e);f[u]||(f[u]=!0,d.insertRule(`@keyframes ${u} ${h}`,d.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${u} ${r}ms linear ${i}ms 1 both`,W+=1,u}function X(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),i=n.length-r.length;i&&(e.style.animation=r.join(", "),W-=i,W||_((()=>{W||(j.forEach((e=>{const{stylesheet:t}=e;let n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.rules={}})),j.clear())})))}function Y(e){V=e}function J(){if(!V)throw new Error("Function called outside component initialization");return V}function Z(e){J().$$.on_mount.push(e)}function $(e){J().$$.on_destroy.push(e)}const Q=[],K=[],ee=[],te=[],ne=Promise.resolve();let re=!1;function ie(e){ee.push(e)}const ae=new Set;let oe,se=0;function le(){const e=V;do{for(;se<Q.length;){const e=Q[se];se++,Y(e),ce(e.$$)}for(Y(null),Q.length=0,se=0;K.length;)K.pop()();for(let e=0;e<ee.length;e+=1){const t=ee[e];ae.has(t)||(ae.add(t),t())}ee.length=0}while(Q.length);for(;te.length;)te.pop()();re=!1,ae.clear(),Y(e)}function ce(e){if(null!==e.fragment){e.update(),m(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ie)}}function he(e,t,n){e.dispatchEvent(function(e,t,n=!1){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,!1,t),r}(`${t?"intro":"outro"}${n}`))}const ue=new Set;let pe;function de(){pe={r:0,c:[],p:pe}}function fe(){pe.r||m(pe.c),pe=pe.p}function me(e,t){e&&e.i&&(ue.delete(e),e.i(t))}function ve(e,t,n,r){if(e&&e.o){if(ue.has(e))return;ue.add(e),pe.c.push((()=>{ue.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}const ge={duration:0};function ye(e,t,n){let r,i,a=t(e,n),o=!1,s=0;function l(){r&&X(e,r)}function c(){const{delay:t=0,duration:n=300,easing:c=u,tick:p=h,css:d}=a||ge;d&&(r=q(e,0,1,n,t,c,d,s++)),p(0,1);const f=w()+t,m=f+n;i&&i.abort(),o=!0,ie((()=>he(e,!0,"start"))),i=function(e){let t;return 0===M.size&&_(S),{promise:new Promise((n=>{M.add(t={c:e,f:n})})),abort(){M.delete(t)}}}((t=>{if(o){if(t>=m)return p(1,0),he(e,!0,"end"),l(),o=!1;if(t>=f){const e=c((t-f)/n);p(e,1-e)}}return o}))}let p=!1;return{start(){p||(p=!0,X(e),v(a)?(a=a(),(oe||(oe=Promise.resolve(),oe.then((()=>{oe=null}))),oe).then(c)):c())},invalidate(){p=!1},end(){o&&(l(),o=!1)}}}function xe(e,t){e.d(1),t.delete(e.key)}function be(e,t){ve(e,1,1,(()=>{t.delete(e.key)}))}function we(e,t,n,r,i,a,o,s,l,c,h,u){let p=e.length,d=a.length,f=p;const m={};for(;f--;)m[e[f].key]=f;const v=[],g=new Map,y=new Map;for(f=d;f--;){const e=u(i,a,f),s=n(e);let l=o.get(s);l?r&&l.p(e,t):(l=c(s,e),l.c()),g.set(s,v[f]=l),s in m&&y.set(s,Math.abs(f-m[s]))}const x=new Set,b=new Set;function w(e){me(e,1),e.m(s,h),o.set(e.key,e),h=e.first,d--}for(;p&&d;){const t=v[d-1],n=e[p-1],r=t.key,i=n.key;t===n?(h=t.first,p--,d--):g.has(i)?!o.has(r)||x.has(r)?w(t):b.has(i)?p--:y.get(r)>y.get(i)?(b.add(r),w(t)):(x.add(i),p--):(l(n,o),p--)}for(;p--;){const t=e[p];g.has(t.key)||l(t,o)}for(;d;)w(v[d-1]);return v}function _e(e,t){const n={},r={},i={$$scope:1};let a=e.length;for(;a--;){const o=e[a],s=t[a];if(s){for(const e in o)e in s||(r[e]=1);for(const e in s)i[e]||(n[e]=s[e],i[e]=1);e[a]=s}else for(const e in o)i[e]=1}for(const o in r)o in n||(n[o]=void 0);return n}function Me(e){e&&e.c()}function Se(e,t,n,r){const{fragment:i,on_mount:a,on_destroy:o,after_update:s}=e.$$;i&&i.m(t,n),r||ie((()=>{const t=a.map(d).filter(v);o?o.push(...t):m(t),e.$$.on_mount=[]})),s.forEach(ie)}function Ee(e,t){const n=e.$$;null!==n.fragment&&(m(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Te(e,t){-1===e.$$.dirty[0]&&(Q.push(e),re||(re=!0,ne.then(le)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ae(e,t,n,r,i,a,o,s=[-1]){const l=V;Y(e);const c=e.$$={fragment:null,ctx:null,props:a,update:h,not_equal:i,bound:f(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:f(),dirty:s,skip_bound:!1,root:t.target||l.$$.root};o&&o(c.root);let u=!1;if(c.ctx=n?n(e,t.props||{},((t,n,...r)=>{const a=r.length?r[0]:n;return c.ctx&&i(c.ctx[t],c.ctx[t]=a)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](a),u&&Te(e,t)),n})):[],c.update(),u=!0,m(c.before_update),c.fragment=!!r&&r(c.ctx),t.target){if(t.hydrate){const e=(p=t.target,Array.from(p.childNodes));c.fragment&&c.fragment.l(e),e.forEach(L)}else c.fragment&&c.fragment.c();t.intro&&me(e.$$.fragment),Se(e,t.target,t.anchor,t.customElement),le()}var p;Y(l)}class Pe{$destroy(){Ee(this,1),this.$destroy=h}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Le(e){let t,n,r,i,a,o,s,l=e[0].name+"";return{c(){t=R("div"),n=R("span"),r=I(l),i=D(),a=R("div"),F(n,"class","room-label-item__text svelte-17nkflf"),U(n,"background-image","url(data:image/png;base64,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)"),G(n,"wide",e[0].name.length>3),F(a,"class","room-label-item__bar svelte-17nkflf"),F(t,"class","room-label-item svelte-17nkflf"),U(t,"z-index",e[0].zIndex,!1),U(t,"transform",e[0].transform,!1),U(t,"opacity",e[0].visible?1:0,!1)},m(l,c){P(l,t,c),E(t,n),E(n,r),E(t,i),E(t,a),o||(s=N(n,"click",e[1]),o=!0)},p(e,[i]){1&i&&l!==(l=e[0].name+"")&&z(r,l),1&i&&G(n,"wide",e[0].name.length>3),1&i&&U(t,"z-index",e[0].zIndex,!1),1&i&&U(t,"transform",e[0].transform,!1),1&i&&U(t,"opacity",e[0].visible?1:0,!1)},i:h,o:h,d(e){e&&L(t),o=!1,s()}}}function Re(e,t,n){let{five:r}=t,{roomLabel:i}=t;return e.$$set=e=>{"five"in e&&n(2,r=e.five),"roomLabel"in e&&n(0,i=e.roomLabel)},[i,function(){r.setState({panoIndex:i.panoIndex,mode:"Panorama",longitude:i.longitude})},r]}class Ce extends Pe{constructor(e){super(),Ae(this,e,Re,Le,g,{five:2,roomLabel:0})}}function Ie(e,t,n){const r=e.slice();return r[9]=t[n],r}function De(e,t){let n,r,i;return r=new Ce({props:{roomLabel:t[9],five:t[1]}}),{key:e,first:null,c(){n=O(),Me(r.$$.fragment),this.first=n},m(e,t){P(e,n,t),Se(r,e,t),i=!0},p(e,n){t=e;const i={};1&n&&(i.roomLabel=t[9]),2&n&&(i.five=t[1]),r.$set(i)},i(e){i||(me(r.$$.fragment,e),i=!0)},o(e){ve(r.$$.fragment,e),i=!1},d(e){e&&L(n),Ee(r,e)}}}function Oe(e){let t,n,r,i=[],a=new Map,o=e[0];const s=e=>e[9].id;for(let l=0;l<o.length;l+=1){let t=Ie(e,o,l),n=s(t);a.set(n,i[l]=De(n,t))}return{c(){t=R("div");for(let e=0;e<i.length;e+=1)i[e].c();F(t,"class","room-labels-container svelte-185yvaa"),ie((()=>e[4].call(t)))},m(a,o){P(a,t,o);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=k(t,e[4].bind(t)),r=!0},p(e,[n]){3&n&&(o=e[0],de(),i=we(i,n,s,1,e,o,a,t,be,De,null,Ie),fe())},i(e){if(!r){for(let e=0;e<o.length;e+=1)me(i[e]);r=!0}},o(e){for(let t=0;t<i.length;t+=1)ve(i[t]);r=!1},d(e){e&&L(t);for(let t=0;t<i.length;t+=1)i[t].d();n()}}}function Ne(e,n,r){let i,a,{five:o}=n,{roomLabels:s}=n;function l(e,n){const r=n.map((n=>{const r=function(e,n){if(null!==e.model.shownFloor&&n.floorIndex!==e.model.shownFloor)return!1;const r=new t.Raycaster,i=e.camera.position.clone(),a=new t.Vector3(n.position.x,n.position.y,n.position.z),o=a.distanceTo(i);r.set(i.clone(),a.clone().sub(i).normalize());const[s]=e.model.intersectRaycaster(r);return!(s&&s.distance+1<o)}(e,n);if(!r)return __spreadProps(__spreadValues({},n),{visible:r});const o=function(e,n){const r=new t.Vector3(n.position.x,n.position.y,n.position.z).clone().project(e.camera);return`translate(${Math.ceil((r.x+1)/2*i)}px, ${Math.ceil((1-r.y)/2*a)}px)`}(e,n);return __spreadProps(__spreadValues({},n),{visible:r,transform:o})})),o=r.filter((({visible:e})=>e)).map((n=>({roomLabelItem:n,distance:new t.Vector3(...Object.values(n.position)).clone().distanceTo(e.camera.position)}))).sort(((e,t)=>e.distance-t.distance));return r.map((e=>{const t=o.findIndex((t=>t.roomLabelItem.id===e.id));return void 0!==t?__spreadProps(__spreadValues({},e),{zIndex:10*t}):e}))}function c(){r(0,s=l(o,s))}return o.on("cameraDirectionUpdate",c),$((()=>{o.off("cameraDirectionUpdate",c)})),Z((()=>{c()})),e.$$set=e=>{"five"in e&&r(1,o=e.five),"roomLabels"in e&&r(0,s=e.roomLabels)},[s,o,i,a,function(){i=this.clientWidth,a=this.clientHeight,r(2,i),r(3,a)}]}class Fe extends Pe{constructor(e){super(),Ae(this,e,Ne,Oe,g,{five:1,roomLabels:0})}}class ze{constructor(e){__publicField(this,"five"),__publicField(this,"enabled",!0),__publicField(this,"fiveModeEnabled"),__publicField(this,"app"),__publicField(this,"wrapper"),__publicField(this,"roomLabels",[]),__publicField(this,"container",document.createElement("div")),__publicField(this,"onFiveModeChange",(e=>{if("Floorplan"!==e)return this.fiveModeEnabled=!1,void this.render();this.five.once("initAnimationEnded",(()=>{this.fiveModeEnabled="Floorplan"===this.five.currentMode,this.render()}))})),this.five=e,this.fiveModeEnabled="Floorplan"===this.five.currentMode,this.container.classList.add("model-room-label-plugin-container"),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="absolute",this.container.style.pointerEvents="none",this.container.style.left="0",this.container.style.top="0",this.five.once("dispose",(()=>this.dispose())),this.five.on("modeChange",this.onFiveModeChange),this.render()}dispose(){this.five.off("modeChange",this.onFiveModeChange),this.container.remove()}load(e){this.roomLabels=function(e){return e.model_room_labels.map((({id:e,pano_index:t,floor_index:n,name:r,position:i,longitude:a})=>({id:e,name:r,position:i,longitude:a,panoIndex:t,floorIndex:n,zIndex:0,visible:!1,transform:""})))}(e),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this.render(),this}disable(){return this.enabled=!1,this.render(),this}enable(){return this.enabled=!0,this.render(),this}render(){var e;if(this.wrapper)return this.enable&&this.fiveModeEnabled?void(this.app?this.app.$set({five:this.five,roomLabels:this.roomLabels}):this.app=new Fe({target:this.container,props:{five:this.five,roomLabels:this.roomLabels}})):(null==(e=this.app)||e.$destroy(),void(this.app=void 0))}}const Ue={position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"10"};function Be(e,t={}){let n="";const{needZ:r,needA:i}=t;return(r?e.slice().concat(e[0]):e.slice()).forEach(((e,r)=>{const{x:a,y:o}=t.format?t.format(e):e,s=a+","+o;return 0===r?(n+="M"+s,n):(null==i?void 0:i[r])?(n+="A"+i[r]+","+s,n):(n+="L"+s,n)})),n+(r?"Z":"")}function ke({x:e,y:t},n,r){const{max:i,min:a}=r;return{x:(e-a.x)*n,y:(i.y-t)*n}}function Ge(e){return{id:e.id,size:e.size,name:e.name,path:e.path,roomType:e.room_type,floorType:e.floor_type,roomLabel:{position:e.room_label.position,positionInImage:e.room_label.position_in_image},observerIndexs:e.observer_indexs}}function He(e){return{floorName:e.floor_name,floorIndex:e.floor_index,rooms:e.rooms.map(Ge),rules:e.rules}}function je(e){return{index:e.index,floorIndex:e.floor_index,position:e.position,positionInImage:e.position_in_image}}async function Ve(e){const t=await async function(e){const t=new Headers({"Content-Type":"text/plain"});return await Promise.all(e.map((async function(e){const n={index:e.index,url:e.url,svgUrl:e.svg_url};if(e.svg_url){const r=await fetch(e.svg_url,{headers:t}).then((e=>e.text()));n.svgContent=r}return n})))}(e.outlines),n=e.computed_data.bounding,r=e.computed_data.floor_datas.map(He),i=e.computed_data.entrance?function(e){return{rad:e.rad,position:e.position,positionInImage:e.position_in_image,northRad:e.north_rad,roomId:e.room_id,floorIndex:e.floor_index}}(e.computed_data.entrance):null;return{outlines:t,entrance:i,bounding:n,floorDatas:r,observers:e.computed_data.observers.map(je)}}function We(e,t,n){const r=e.map((e=>{const r=e.position,i=e.icon?e.icon:{url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC",width:45,height:48},a=function(e,t){return Math.max(...t.work.observers.map((t=>e.z>=t.standingPosition.z?t.floorIndex:0)))}(r,t),o=function(e,t){return{x:1e3*e.x+t.bounding.origin.x,y:1e3*-e.z+t.bounding.origin.y}}(r,n),s=function(e,t){const n=t.bounding,r=n.max.x-n.min.x,i=n.max.y-n.min.y;return{x:(e.x-n.min.x)/r,y:(n.max.y-e.y)/i}}(o,n);return{floorIndex:a,icon:i,id:e.id,position:o,positionInImage:s}}));return r}function qe(e,t){return(n=>{for(const r in e)-1===t.indexOf(r)&&(n[r]=e[r])})(n={}),n;var n}function Xe(e,t){const n=new o.Vector3(0,0,0);e.model.bounding.getCenter(n);const{y:r}=n,{longitude:i}=e.getCurrentState(),a=1/Math.abs(Math.cos(i)),s=new o.Vector3(0,r,0),l=new o.Vector3(a,r,0),c=s.project(e.camera),h=l.project(e.camera);return Math.abs((h.x-c.x)/1e3)*(t.getBoundingClientRect().width/2)}const Ye="data:image/png;base64,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";function Je(e){let t,n;return{c(){t=R("div"),n=R("div"),F(n,"class","floorplan__camera-rotate svelte-1kosz2p"),U(n,"background-image",`url(${e[0]||Ye})`),U(n,"width",e[4],!1),U(n,"height",e[4],!1),U(n,"transform",`rotate(${e[3]}deg)`,!1),F(t,"class","floorplan__camera-position svelte-1kosz2p"),U(t,"left",e[1],!1),U(t,"top",e[2],!1)},m(e,r){P(e,t,r),E(t,n)},p(e,[t]){1&t&&U(n,"background-image",`url(${e[0]||Ye})`)},i:h,o:h,d(e){e&&L(t)}}}function Ze(e,t,n){let{panoIndex:r}=t,{floorplanData:i}=t,{lastPanoramaLongitude:a}=t,{cameraImageUrl:o}=t;const{observers:s}=i,l=s[r],c=100*l.positionInImage.x+"%",h=100*l.positionInImage.y+"%",u=-180*a/Math.PI+45;const p=document.body.clientWidth,d=document.body.clientHeight,f=(p<500||d<500?17:37)/16+"rem";return e.$$set=e=>{"panoIndex"in e&&n(5,r=e.panoIndex),"floorplanData"in e&&n(6,i=e.floorplanData),"lastPanoramaLongitude"in e&&n(7,a=e.lastPanoramaLongitude),"cameraImageUrl"in e&&n(0,o=e.cameraImageUrl)},[o,c,h,u,f,r,i,a]}class $e extends Pe{constructor(e){super(),Ae(this,e,Ze,Je,g,{panoIndex:5,floorplanData:6,lastPanoramaLongitude:7,cameraImageUrl:0})}}function Qe(e){let t,n=e[0]&&function(e){let t,n,r,i;return{c(){t=R("div"),n=R("div"),r=D(),i=R("span"),i.textContent="北",F(n,"class","floorplan-plugin__compass-image svelte-5l80pv"),U(n,"background-image","url(data:image/png;base64,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)"),F(i,"class","floorplan-plugin__compass-text svelte-5l80pv"),F(t,"class","floorplan-plugin__compass svelte-5l80pv"),U(t,"transform",e[1],!1)},m(e,a){P(e,t,a),E(t,n),E(t,r),E(t,i)},p:h,d(e){e&&L(t)}}}(e);return{c(){n&&n.c(),t=O()},m(e,r){n&&n.m(e,r),P(e,t,r)},p(e,[t]){e[0]&&n.p(e,t)},i:h,o:h,d(e){n&&n.d(e),e&&L(t)}}}function Ke(e,t,n){var r;let{floorplanData:i}=t;const a=null==(r=i.entrance)?void 0:r.northRad;const o=`translateX(-50%) translateZ(10px) rotate(${90-(a?a/Math.PI*180:0)}deg)`;return e.$$set=e=>{"floorplanData"in e&&n(2,i=e.floorplanData)},[a,o,i]}class et extends Pe{constructor(e){super(),Ae(this,e,Ke,Qe,g,{floorplanData:2})}}function tt(e,{delay:t=0,duration:n=400,easing:r=u}={}){const i=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:r,css:e=>"opacity: "+e*i}}function nt(e){let t,n,r=e[2].outerHTML+"";return{c(){t=new H,n=O(),t.a=n},m(e,i){t.m(r,e,i),P(e,n,i)},p(e,n){4&n&&r!==(r=e[2].outerHTML+"")&&t.p(r)},d(e){e&&L(n),e&&t.d()}}}function rt(e){let t,n,r,i,a=e[0].name+"";return{c(){t=R("span"),n=I(a),r=D(),i=R("span"),i.textContent=`${e[3]}`,F(t,"class","floorplan-plugin__room-name"),F(i,"class","floorplan-plugin__room-size svelte-1ashbdx")},m(e,a){P(e,t,a),E(t,n),P(e,r,a),P(e,i,a)},p(e,t){1&t&&a!==(a=e[0].name+"")&&z(n,a)},d(e){e&&L(t),e&&L(r),e&&L(i)}}}function it(e){let t;function n(e,t){return void 0===e[1]?rt:e[2]?nt:void 0}let r=n(e),i=r&&r(e);return{c(){t=R("div"),i&&i.c(),F(t,"class","floorplan-plugin__room-label-item svelte-1ashbdx"),U(t,"left",e[4],!1),U(t,"top",e[5],!1),U(t,"font-size",e[6],!1)},m(e,n){P(e,t,n),i&&i.m(t,null)},p(e,[a]){r===(r=n(e))&&i?i.p(e,a):(i&&i.d(1),i=r&&r(e),i&&(i.c(),i.m(t,null)))},i:h,o:h,d(e){e&&L(t),i&&i.d()}}}function at(e,t,n){let r,{room:i}=t,{getLabelElement:a}=t;const o=document.body.clientWidth,s=document.body.clientHeight,l=i.size?(i.size/1e6).toFixed(1)+"㎡":"",c=i.roomLabel,h=100*c.positionInImage.x+"%",u=100*c.positionInImage.y+"%",p=(o<500||s<500?10:14)/16+"rem";return e.$$set=e=>{"room"in e&&n(0,i=e.room),"getLabelElement"in e&&n(1,a=e.getLabelElement)},e.$$.update=()=>{3&e.$$.dirty&&n(2,r=null==a?void 0:a(i))},[i,a,r,l,h,u,p]}class ot extends Pe{constructor(e){super(),Ae(this,e,at,it,g,{room:0,getLabelElement:1})}}function st(e,t,n){const r=e.slice();return r[4]=t[n],r}function lt(e){let t,n,r=[],i=new Map,a=e[1];const o=e=>e[4].id;for(let s=0;s<a.length;s+=1){let t=st(e,a,s),n=o(t);i.set(n,r[s]=ct(n,t))}return{c(){t=R("div");for(let e=0;e<r.length;e+=1)r[e].c();F(t,"class","floorplan-plugin__room-labels svelte-sw25w3")},m(e,i){P(e,t,i);for(let n=0;n<r.length;n+=1)r[n].m(t,null);n=!0},p(e,n){3&n&&(a=e[1],de(),r=we(r,n,o,1,e,a,i,t,be,ct,null,st),fe())},i(e){if(!n){for(let e=0;e<a.length;e+=1)me(r[e]);n=!0}},o(e){for(let t=0;t<r.length;t+=1)ve(r[t]);n=!1},d(e){e&&L(t);for(let t=0;t<r.length;t+=1)r[t].d()}}}function ct(e,t){let n,r,i;const a=[{room:t[4],getLabelElement:t[0]}];let o={};for(let s=0;s<a.length;s+=1)o=p(o,a[s]);return r=new ot({props:o}),{key:e,first:null,c(){n=O(),Me(r.$$.fragment),this.first=n},m(e,t){P(e,n,t),Se(r,e,t),i=!0},p(e,n){t=e;const i=3&n?_e(a,[{room:t[4],getLabelElement:t[0]}]):{};r.$set(i)},i(e){i||(me(r.$$.fragment,e),i=!0)},o(e){ve(r.$$.fragment,e),i=!1},d(e){e&&L(n),Ee(r,e)}}}function ht(e){let t,n,r=e[1]&&lt(e);return{c(){r&&r.c(),t=O()},m(e,i){r&&r.m(e,i),P(e,t,i),n=!0},p(e,[n]){e[1]?r?(r.p(e,n),2&n&&me(r,1)):(r=lt(e),r.c(),me(r,1),r.m(t.parentNode,t)):r&&(de(),ve(r,1,1,(()=>{r=null})),fe())},i(e){n||(me(r),n=!0)},o(e){ve(r),n=!1},d(e){r&&r.d(e),e&&L(t)}}}function ut(e,t,n){let r,{floorIndex:i}=t,{floorplanData:a}=t,{getLabelElement:o}=t;return e.$$set=e=>{"floorIndex"in e&&n(2,i=e.floorIndex),"floorplanData"in e&&n(3,a=e.floorplanData),"getLabelElement"in e&&n(0,o=e.getLabelElement)},e.$$.update=()=>{12&e.$$.dirty&&n(1,r=a.floorDatas[i].rooms)},[o,r,i,a]}class pt extends Pe{constructor(e){super(),Ae(this,e,ut,ht,g,{floorIndex:2,floorplanData:3,getLabelElement:0})}}function dt(e){return null!=e}function ft(e,t,n){const r=e.slice();return r[24]=t[n],r[26]=n,r}function mt(e,t,n){const r=e.slice();return r[27]=t[n],r[29]=n,r}function vt(e,t){let n,r=`${t[27]}px`;return{key:e,first:null,c(){n=R("div"),F(n,"class","floorplan-plugin__rule-scale svelte-1rr09in"),U(n,"left",r,!1),this.first=n},m(e,t){P(e,n,t)},p(e,n){t=e},d(e){e&&L(n)}}}function gt(e,t){let n,r,i,a,o=t[24].distance+"",s=`${t[24].positionPx}px`;return{key:e,first:null,c(){n=R("div"),r=R("span"),i=I(o),a=D(),F(r,"class","floorplan-plugin__rule-text svelte-1rr09in"),G(r,"is-row",t[5]),F(n,"class","floorplan-plugin__text-wrapper svelte-1rr09in"),G(n,"floorplan-plugin__text-wrapper--is-left-or-top",t[3]||t[1]),G(n,"floorplan-plugin__text-wrapper-is-right-or-bottom",t[4]||t[2]),U(n,"left",s,!1),this.first=n},m(e,t){P(e,n,t),E(n,r),E(r,i),E(n,a)},p(e,n){t=e},d(e){e&&L(n)}}}function yt(e){let t,n,r,i,a,o=[],s=new Map,l=[],c=new Map,u=e[6];const p=e=>e[29];for(let h=0;h<u.length;h+=1){let t=mt(e,u,h),n=p(t);s.set(n,o[h]=vt(n,t))}let d=e[10];const f=e=>e[26];for(let h=0;h<d.length;h+=1){let t=ft(e,d,h),n=f(t);c.set(n,l[h]=gt(n,t))}return{c(){t=R("div"),n=R("div"),r=D();for(let e=0;e<o.length;e+=1)o[e].c();i=D();for(let e=0;e<l.length;e+=1)l[e].c();F(n,"class","floorplan-plugin__rule-line svelte-1rr09in"),F(t,"class",a="floorplan-plugin__rule-labels floorplan-plugin__rule-labels-"+e[0]+" svelte-1rr09in"),U(t,"width",e[9],!1),U(t,"transform",e[7],!1),U(t,"transform-origin",e[8],!1)},m(e,a){P(e,t,a),E(t,n),E(t,r);for(let n=0;n<o.length;n+=1)o[n].m(t,null);E(t,i);for(let n=0;n<l.length;n+=1)l[n].m(t,null)},p(e,[n]){64&n&&(u=e[6],o=we(o,n,p,1,e,u,s,t,xe,vt,i,mt)),1086&n&&(d=e[10],l=we(l,n,f,1,e,d,c,t,xe,gt,null,ft)),1&n&&a!==(a="floorplan-plugin__rule-labels floorplan-plugin__rule-labels-"+e[0]+" svelte-1rr09in")&&F(t,"class",a)},i:h,o:h,d(e){e&&L(t);for(let t=0;t<o.length;t+=1)o[t].d();for(let t=0;t<l.length;t+=1)l[t].d()}}}function xt(e,t,n){let{pxmm:r}=t,{type:i}=t,{data:a}=t,{bounding:o}=t;const s="top"===i,l="bottom"===i,c="left"===i,h="right"===i,u=s||l,p=a.map((([e,t])=>u?[e.x,t.x]:[e.y,t.y])).flat().sort().filter(((e,t,n)=>0===t||e!==n[t-1])),d=p[0],f=p.slice(-1)[0]-d,m=u?o.min.x:o.min.y,v=f*r,g=p.map((e=>(e-d)/f*v)),y=(d-m)*r,x=27-1e3*r,b=`${s?`translate(${y}px, ${-x}px)`:l?`translate(${y}px, ${x}px)`:c?`translate(${-x}px, ${-y}px)`:h?`translate(${x}px, ${-y-v}px)`:void 0} ${u?"rotate(0)":"rotate(-90deg)"}`,w=`${h?"right":"left"} ${s?"top":"bottom"}`,_=v+"px",M=p.map(((e,t,n)=>{if(0===t)return null;const r=e-n[t-1];return{distance:r,positionPx:(n[t-1]+r/2-d)/f*v}})).filter(dt).filter((e=>e.distance/f>.12));return e.$$set=e=>{"pxmm"in e&&n(11,r=e.pxmm),"type"in e&&n(0,i=e.type),"data"in e&&n(12,a=e.data),"bounding"in e&&n(13,o=e.bounding)},[i,s,l,c,h,u,g,b,w,_,M,r,a,o]}class bt extends Pe{constructor(e){super(),Ae(this,e,xt,yt,g,{pxmm:11,type:0,data:12,bounding:13})}}function wt(e,t,n){const r=e.slice();return r[7]=t[n][0],r[8]=t[n][1],r}function _t(e,t){let n,r,i;const a=[{type:t[7],data:t[8],pxmm:t[0],bounding:t[2]}];let o={};for(let s=0;s<a.length;s+=1)o=p(o,a[s]);return r=new bt({props:o}),{key:e,first:null,c(){n=O(),Me(r.$$.fragment),this.first=n},m(e,t){P(e,n,t),Se(r,e,t),i=!0},p(e,n){t=e;const i=7&n?_e(a,[{type:t[7],data:t[8],pxmm:t[0],bounding:t[2]}]):{};r.$set(i)},i(e){i||(me(r.$$.fragment,e),i=!0)},o(e){ve(r.$$.fragment,e),i=!1},d(e){e&&L(n),Ee(r,e)}}}function Mt(e){let t,n,r=[],i=new Map,a=e[1];const o=e=>e[7];for(let s=0;s<a.length;s+=1){let t=wt(e,a,s),n=o(t);i.set(n,r[s]=_t(n,t))}return{c(){t=R("div");for(let e=0;e<r.length;e+=1)r[e].c();F(t,"class","floorplan-plugin__rulelabels")},m(e,i){P(e,t,i);for(let n=0;n<r.length;n+=1)r[n].m(t,null);n=!0},p(e,[n]){7&n&&(a=e[1],de(),r=we(r,n,o,1,e,a,i,t,be,_t,null,wt),fe())},i(e){if(!n){for(let e=0;e<a.length;e+=1)me(r[e]);n=!0}},o(e){for(let t=0;t<r.length;t+=1)ve(r[t]);n=!1},d(e){e&&L(t);for(let t=0;t<r.length;t+=1)r[t].d()}}}function St(e,t,n){let r,i,a,o,{pxmm:s}=t,{floorIndex:l}=t,{floorplanData:c}=t;return e.$$set=e=>{"pxmm"in e&&n(0,s=e.pxmm),"floorIndex"in e&&n(3,l=e.floorIndex),"floorplanData"in e&&n(4,c=e.floorplanData)},e.$$.update=()=>{16&e.$$.dirty&&n(2,r=c.bounding),24&e.$$.dirty&&n(5,i=c.floorDatas[l].rules),32&e.$$.dirty&&n(6,a=Object.keys(i)),96&e.$$.dirty&&n(1,o=a.map((e=>[e,i[e]])))},[s,o,r,l,c,i,a]}class Et extends Pe{constructor(e){super(),Ae(this,e,St,Mt,g,{pxmm:0,floorIndex:3,floorplanData:4})}}function Tt(e){let t,n;return{c(){t=R("img"),x(t.src,n=e[0])||F(t,"src",n),F(t,"alt","floorplan iamge"),F(t,"class","svelte-1cuuebb")},m(e,n){P(e,t,n)},p(e,[r]){1&r&&!x(t.src,n=e[0])&&F(t,"src",n)},i:h,o:h,d(e){e&&L(t)}}}function At(e,t,n){let{url:r}=t;return e.$$set=e=>{"url"in e&&n(0,r=e.url)},[r]}class Pt extends Pe{constructor(e){super(),Ae(this,e,At,Tt,g,{url:0})}}function Lt(e){let t,n,r,i;return{c(){t=R("div"),n=new H,r=D(),i=new H,n.a=r,i.a=null,F(t,"class","floorplan-plugin__base-image svelte-1qqy56u")},m(a,o){P(a,t,o),n.m(e[1],t),E(t,r),i.m(e[0],t)},p(e,[t]){1&t&&i.p(e[0])},i:h,o:h,d(e){e&&L(t)}}}function Rt(e,t,n){let{content:r}=t;return e.$$set=e=>{"content"in e&&n(0,r=e.content)},[r,"\n <style>\n svg [type='lineGroup'] path {\n fill: #ffffff;\n stroke: #ffffff;\n }\n svg [type='lineItemGroup'] g g g g {\n stroke: #ffffff;\n }\n </style>\n "]}class Ct extends Pe{constructor(e){super(),Ae(this,e,Rt,Lt,g,{content:0})}}function It(e){let t,n;return t=new Pt({props:{url:e[1].url}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};2&n&&(r.url=e[1].url),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function Dt(e){let t,n;return t=new Ct({props:{content:e[0]}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.content=e[0]),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function Ot(e){let t,n,r,i;const a=[Dt,It],o=[];function s(e,t){return e[0]?0:e[1]?1:-1}return~(n=s(e))&&(r=o[n]=a[n](e)),{c(){t=R("div"),r&&r.c(),F(t,"class","floorplan-plugin__base-image svelte-126ja8e")},m(e,r){P(e,t,r),~n&&o[n].m(t,null),i=!0},p(e,[i]){let l=n;n=s(e),n===l?~n&&o[n].p(e,i):(r&&(de(),ve(o[l],1,1,(()=>{o[l]=null})),fe()),~n?(r=o[n],r?r.p(e,i):(r=o[n]=a[n](e),r.c()),me(r,1),r.m(t,null)):r=null)},i(e){i||(me(r),i=!0)},o(e){ve(r),i=!1},d(e){e&&L(t),~n&&o[n].d()}}}function Nt(e,t,n){let r,i,{floorIndex:a}=t,{floorplanData:o}=t;return e.$$set=e=>{"floorIndex"in e&&n(2,a=e.floorIndex),"floorplanData"in e&&n(3,o=e.floorplanData)},e.$$.update=()=>{var t,s;12&e.$$.dirty&&n(1,r=o.outlines[a]),12&e.$$.dirty&&n(0,i=null==(s=null==(t=o.outlines)?void 0:t[a])?void 0:s.svgContent)},[i,r,a,o]}class Ft extends Pe{constructor(e){super(),Ae(this,e,Nt,Ot,g,{floorIndex:2,floorplanData:3})}}function zt(e){let t;return{c(){t=C("path"),F(t,"d",e[0]),F(t,"fill","#2F313A")},m(e,n){P(e,t,n)},p(e,[n]){1&n&&F(t,"d",e[0])},i:h,o:h,d(e){e&&L(t)}}}function Ut(e,t,n){let r,{path:i}=t;return e.$$set=e=>{"path"in e&&n(1,i=e.path)},e.$$.update=()=>{2&e.$$.dirty&&n(0,r=Be(i,{needZ:!0}))},[r,i]}class Bt extends Pe{constructor(e){super(),Ae(this,e,Ut,zt,g,{path:1})}}function kt(e){let t,n,r,i,a,o;return{c(){t=C("defs"),n=C("pattern"),r=C("rect"),i=C("path"),a=D(),o=C("path"),F(r,"x","0"),F(r,"y","0"),F(r,"width",e[1]),F(r,"height",e[1]),F(r,"fill","#323747"),F(i,"d",e[2]),F(i,"stroke","#ffffff"),F(i,"stroke-opacity","0.06"),F(i,"stroke-width","0.5"),F(i,"fill","none"),F(n,"id","fpm-room-pattern-0"),F(n,"x","0"),F(n,"y","0"),F(n,"width",e[1]),F(n,"height",e[1]),F(n,"patternUnits","userSpaceOnUse"),F(o,"d",e[0]),F(o,"fill","url(#fpm-room-pattern-0)")},m(e,s){P(e,t,s),E(t,n),E(n,r),E(n,i),P(e,a,s),P(e,o,s)},p(e,[t]){1&t&&F(o,"d",e[0])},i:h,o:h,d(e){e&&L(t),e&&L(a),e&&L(o)}}}function Gt(e,t,n){let r,{path:i}=t;return e.$$set=e=>{"path"in e&&n(3,i=e.path)},e.$$.update=()=>{8&e.$$.dirty&&n(0,r=Be(i,{needZ:!0}))},[r,12,"M0 6 h 12 M6 0 v 12",i]}class Ht extends Pe{constructor(e){super(),Ae(this,e,Gt,kt,g,{path:3})}}function jt(e){let t,n,r,i,a,o,s,l,c,u,p;return{c(){t=C("defs"),n=C("pattern"),r=C("rect"),i=C("pattern"),a=C("rect"),o=D(),s=C("path"),l=D(),c=C("path"),u=D(),p=C("path"),F(r,"x","0.5"),F(r,"y","0.5"),F(r,"width","6"),F(r,"height","50"),F(r,"fill","none"),F(r,"stroke","#4B4B57"),F(r,"stroke-width","0.5"),F(n,"id","room-material-pattern-1"),F(n,"x","0"),F(n,"y","0"),F(n,"width","13"),F(n,"height","51"),F(n,"patternUnits","userSpaceOnUse"),F(a,"x","0.5"),F(a,"y","0.5"),F(a,"width","6"),F(a,"height","50"),F(a,"fill","none"),F(a,"stroke","#4B4B57"),F(a,"stroke-width","0.5"),F(i,"id","room-material-pattern-2"),F(i,"x","7"),F(i,"y","25"),F(i,"width","13"),F(i,"height","51"),F(i,"patternUnits","userSpaceOnUse"),F(s,"d",e[0]),F(s,"fill","#43434D"),F(c,"d",e[0]),F(c,"fill","url(#room-material-pattern-1)"),F(p,"d",e[0]),F(p,"fill","url(#room-material-pattern-2)")},m(e,h){P(e,t,h),E(t,n),E(n,r),E(t,i),E(i,a),P(e,o,h),P(e,s,h),P(e,l,h),P(e,c,h),P(e,u,h),P(e,p,h)},p(e,[t]){1&t&&F(s,"d",e[0]),1&t&&F(c,"d",e[0]),1&t&&F(p,"d",e[0])},i:h,o:h,d(e){e&&L(t),e&&L(o),e&&L(s),e&&L(l),e&&L(c),e&&L(u),e&&L(p)}}}function Vt(e,t,n){let r,{path:i}=t;return e.$$set=e=>{"path"in e&&n(1,i=e.path)},e.$$.update=()=>{2&e.$$.dirty&&n(0,r=Be(i,{needZ:!0}))},[r,i]}class Wt extends Pe{constructor(e){super(),Ae(this,e,Vt,jt,g,{path:1})}}function qt(e,t,n){const r=e.slice();return r[4]=t[n],r}function Xt(e){let t,n;return t=new Ht({props:{path:e[4].path}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.path=e[4].path),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function Yt(e){let t,n;return t=new Wt({props:{path:e[4].path}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.path=e[4].path),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function Jt(e){let t,n;return t=new Bt({props:{path:e[4].path}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.path=e[4].path),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function Zt(e){let t,n,r,i;const a=[Jt,Yt,Xt],o=[];function s(e,t){return 1===e[4].floorType?0:0===e[4].floorType?1:2}return n=s(e),r=o[n]=a[n](e),{c(){t=C("svg"),r.c(),F(t,"class","svelte-1b0icjc")},m(e,r){P(e,t,r),o[n].m(t,null),i=!0},p(e,i){let l=n;n=s(e),n===l?o[n].p(e,i):(de(),ve(o[l],1,1,(()=>{o[l]=null})),fe(),r=o[n],r?r.p(e,i):(r=o[n]=a[n](e),r.c()),me(r,1),r.m(t,null))},i(e){i||(me(r),i=!0)},o(e){ve(r),i=!1},d(e){e&&L(t),o[n].d()}}}function $t(e){let t,n,r=e[0],i=[];for(let o=0;o<r.length;o+=1)i[o]=Zt(qt(e,r,o));const a=e=>ve(i[e],1,1,(()=>{i[e]=null}));return{c(){t=R("div");for(let e=0;e<i.length;e+=1)i[e].c();F(t,"class","floorplan-plugin__room-material")},m(e,r){P(e,t,r);for(let n=0;n<i.length;n+=1)i[n].m(t,null);n=!0},p(e,[n]){if(1&n){let o;for(r=e[0],o=0;o<r.length;o+=1){const a=qt(e,r,o);i[o]?(i[o].p(a,n),me(i[o],1)):(i[o]=Zt(a),i[o].c(),me(i[o],1),i[o].m(t,null))}for(de(),o=r.length;o<i.length;o+=1)a(o);fe()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)me(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let t=0;t<i.length;t+=1)ve(i[t]);n=!1},d(e){e&&L(t),function(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}(i,e)}}}function Qt(e,t,n){let r,{floorIndex:i}=t,{pxmm:a}=t,{floorplanData:o}=t;return e.$$set=e=>{"floorIndex"in e&&n(1,i=e.floorIndex),"pxmm"in e&&n(2,a=e.pxmm),"floorplanData"in e&&n(3,o=e.floorplanData)},e.$$.update=()=>{14&e.$$.dirty&&n(0,r=o.floorDatas[i].rooms.map((e=>__spreadProps(__spreadValues({},e),{path:e.path.map((e=>ke(e,a,o.bounding)))}))))},[r,i,a,o]}class Kt extends Pe{constructor(e){super(),Ae(this,e,Qt,$t,g,{floorIndex:1,pxmm:2,floorplanData:3})}}function en(e){let t;return{c(){t=C("path"),F(t,"d",e[0]),F(t,"fill","#fff"),F(t,"class","svelte-11takew")},m(e,n){P(e,t,n)},p:h,i:h,o:h,d(e){e&&L(t)}}}function tn(e,t,n){let{pxmm:r}=t,{room:i}=t,{floorplanData:a}=t;const{bounding:o}=a,s=Be(i.path,{needZ:!0,format:e=>ke(e,r,o)});return e.$$set=e=>{"pxmm"in e&&n(1,r=e.pxmm),"room"in e&&n(2,i=e.room),"floorplanData"in e&&n(3,a=e.floorplanData)},[s,r,i,a]}class nn extends Pe{constructor(e){super(),Ae(this,e,tn,en,g,{pxmm:1,room:2,floorplanData:3})}}function rn(e,t,n){const r=e.slice();return r[12]=t[n],r}function an(e,t){let n,r,i;const a=[{room:t[12],floorplanData:t[2],pxmm:t[0]}];let o={};for(let s=0;s<a.length;s+=1)o=p(o,a[s]);return r=new nn({props:o}),{key:e,first:null,c(){n=O(),Me(r.$$.fragment),this.first=n},m(e,t){P(e,n,t),Se(r,e,t),i=!0},p(e,n){t=e;const i=7&n?_e(a,[{room:t[12],floorplanData:t[2],pxmm:t[0]}]):{};r.$set(i)},i(e){i||(me(r.$$.fragment,e),i=!0)},o(e){ve(r.$$.fragment,e),i=!1},d(e){e&&L(n),Ee(r,e)}}}function on(e){let t,n,r,i,a,o,s=[],l=new Map,c=e[2].floorDatas[e[1]].rooms;const h=e=>e[12].id;for(let u=0;u<c.length;u+=1){let t=rn(e,c,u),n=h(t);l.set(n,s[u]=an(n,t))}return{c(){t=R("div"),n=C("svg");for(let e=0;e<s.length;e+=1)s[e].c();F(n,"class","svelte-1aais5l"),F(t,"class","floorplan-plugin__room-highlight svelte-1aais5l"),ie((()=>e[10].call(t)))},m(l,c){P(l,t,c),E(t,n);for(let e=0;e<s.length;e+=1)s[e].m(n,null);e[9](t),r=k(t,e[10].bind(t)),i=!0,a||(o=N(t,"click",e[6]),a=!0)},p(e,[t]){7&t&&(c=e[2].floorDatas[e[1]].rooms,de(),s=we(s,t,h,1,e,c,l,n,be,an,null,rn),fe())},i(e){if(!i){for(let e=0;e<c.length;e+=1)me(s[e]);i=!0}},o(e){for(let t=0;t<s.length;t+=1)ve(s[t]);i=!1},d(n){n&&L(t);for(let e=0;e<s.length;e+=1)s[e].d();e[9](null),r(),a=!1,o()}}}function sn(e,n,r){let i,a,o,{five:s}=n,{pxmm:l}=n,{floorIndex:c}=n,{floorplanData:h}=n,{onRoomHeightClick:u}=n;const{observers:p}=h;return e.$$set=e=>{"five"in e&&r(7,s=e.five),"pxmm"in e&&r(0,l=e.pxmm),"floorIndex"in e&&r(1,c=e.floorIndex),"floorplanData"in e&&r(2,h=e.floorplanData),"onRoomHeightClick"in e&&r(8,u=e.onRoomHeightClick)},[l,c,h,i,a,o,function(e){if(!1===(null==u?void 0:u(e)))return;const n=o.getBoundingClientRect(),r=new t.Vector2(e.clientX,e.clientY),l=new t.Vector2(n.left,n.top),h=r.clone().sub(l),d=new t.Vector2(h.x/i,h.y/a),f=p.filter((e=>e.floorIndex===c)).sort(((e,n)=>{const r=new t.Vector2(e.positionInImage.x,e.positionInImage.y),i=new t.Vector2(n.positionInImage.x,n.positionInImage.y);return r.distanceTo(d)-i.distanceTo(d)}))[0];s.moveToPano(f.index)},s,u,function(e){K[e?"unshift":"push"]((()=>{o=e,r(5,o)}))},function(){i=this.clientWidth,a=this.clientHeight,r(3,i),r(4,a)}]}class ln extends Pe{constructor(e){super(),Ae(this,e,sn,on,g,{five:7,pxmm:0,floorIndex:1,floorplanData:2,onRoomHeightClick:8})}}function cn(e){let t,n;const r=[{five:e[1],pxmm:e[0],floorIndex:e[2],floorplanData:e[6],onRoomHeightClick:e[7]}];let i={};for(let a=0;a<r.length;a+=1)i=p(i,r[a]);return t=new ln({props:i}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const i=199&n?_e(r,[{five:e[1],pxmm:e[0],floorIndex:e[2],floorplanData:e[6],onRoomHeightClick:e[7]}]):{};t.$set(i)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function hn(e){let t,n;const r=[{floorplanData:e[6],floorIndex:e[2],getLabelElement:e[8]}];let i={};for(let a=0;a<r.length;a+=1)i=p(i,r[a]);return t=new pt({props:i}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const i=324&n?_e(r,[{floorplanData:e[6],floorIndex:e[2],getLabelElement:e[8]}]):{};t.$set(i)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function un(e){let t,n;const r=[{floorplanData:e[6],floorIndex:e[2],pxmm:e[0]}];let i={};for(let a=0;a<r.length;a+=1)i=p(i,r[a]);return t=new Et({props:i}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const i=69&n?_e(r,[{floorplanData:e[6],floorIndex:e[2],pxmm:e[0]}]):{};t.$set(i)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function pn(e){let t,n,r,i,a,o,s,l;const c=[{floorIndex:e[2],floorplanData:e[6],pxmm:e[0]}];let h={};for(let g=0;g<c.length;g+=1)h=p(h,c[g]);n=new Kt({props:h});let u=e[3]&&cn(e);const d=[{floorplanData:e[6],floorIndex:e[2]}];let f={};for(let g=0;g<d.length;g+=1)f=p(f,d[g]);a=new Ft({props:f});let m=e[4]&&hn(e),v=e[5]&&un(e);return{c(){t=R("div"),Me(n.$$.fragment),r=D(),u&&u.c(),i=D(),Me(a.$$.fragment),o=D(),m&&m.c(),s=D(),v&&v.c(),F(t,"class","floorplan-current-floor svelte-3pdgs4")},m(e,c){P(e,t,c),Se(n,t,null),E(t,r),u&&u.m(t,null),E(t,i),Se(a,t,null),E(t,o),m&&m.m(t,null),E(t,s),v&&v.m(t,null),l=!0},p(e,[r]){const o=69&r?_e(c,[{floorIndex:e[2],floorplanData:e[6],pxmm:e[0]}]):{};n.$set(o),e[3]?u?(u.p(e,r),8&r&&me(u,1)):(u=cn(e),u.c(),me(u,1),u.m(t,i)):u&&(de(),ve(u,1,1,(()=>{u=null})),fe());const l=68&r?_e(d,[{floorplanData:e[6],floorIndex:e[2]}]):{};a.$set(l),e[4]?m?(m.p(e,r),16&r&&me(m,1)):(m=hn(e),m.c(),me(m,1),m.m(t,s)):m&&(de(),ve(m,1,1,(()=>{m=null})),fe()),e[5]?v?(v.p(e,r),32&r&&me(v,1)):(v=un(e),v.c(),me(v,1),v.m(t,null)):v&&(de(),ve(v,1,1,(()=>{v=null})),fe())},i(e){l||(me(n.$$.fragment,e),me(u),me(a.$$.fragment,e),me(m),me(v),l=!0)},o(e){ve(n.$$.fragment,e),ve(u),ve(a.$$.fragment,e),ve(m),ve(v),l=!1},d(e){e&&L(t),Ee(n),u&&u.d(),Ee(a),m&&m.d(),v&&v.d()}}}function dn(e,t,n){let{pxmm:r}=t,{five:i}=t,{floorIndex:a}=t,{hoverEnable:o}=t,{roomLabelsEnable:s}=t,{ruleLabelsEnable:l}=t,{floorplanData:c}=t,{onRoomHeightClick:h}=t,{getLabelElement:u}=t;return e.$$set=e=>{"pxmm"in e&&n(0,r=e.pxmm),"five"in e&&n(1,i=e.five),"floorIndex"in e&&n(2,a=e.floorIndex),"hoverEnable"in e&&n(3,o=e.hoverEnable),"roomLabelsEnable"in e&&n(4,s=e.roomLabelsEnable),"ruleLabelsEnable"in e&&n(5,l=e.ruleLabelsEnable),"floorplanData"in e&&n(6,c=e.floorplanData),"onRoomHeightClick"in e&&n(7,h=e.onRoomHeightClick),"getLabelElement"in e&&n(8,u=e.getLabelElement)},[r,i,a,o,s,l,c,h,u]}class fn extends Pe{constructor(e){super(),Ae(this,e,dn,pn,g,{pxmm:0,five:1,floorIndex:2,hoverEnable:3,roomLabelsEnable:4,ruleLabelsEnable:5,floorplanData:6,onRoomHeightClick:7,getLabelElement:8})}}function mn(e){let t,n,r,i,a,o,s;const l=[{five:e[1],pxmm:e[0],floorIndex:e[5],hoverEnable:e[6],floorplanData:e[10],getLabelElement:e[14],roomLabelsEnable:e[8],ruleLabelsEnable:e[9],onRoomHeightClick:e[13]}];let c={};for(let u=0;u<l.length;u+=1)c=p(c,l[u]);n=new fn({props:c});const h=[{panoIndex:e[4],floorplanData:e[10],lastPanoramaLongitude:e[11],cameraImageUrl:e[12]}];let d={};for(let u=0;u<h.length;u+=1)d=p(d,h[u]);i=new $e({props:d});let f=e[7]&&vn(e);return{c(){t=R("div"),Me(n.$$.fragment),r=D(),Me(i.$$.fragment),a=D(),f&&f.c(),F(t,"class","floorplan-main svelte-177x2q7")},m(e,o){P(e,t,o),Se(n,t,null),E(t,r),Se(i,t,null),E(t,a),f&&f.m(t,null),s=!0},p(r,a){e=r;const o=26467&a?_e(l,[{five:e[1],pxmm:e[0],floorIndex:e[5],hoverEnable:e[6],floorplanData:e[10],getLabelElement:e[14],roomLabelsEnable:e[8],ruleLabelsEnable:e[9],onRoomHeightClick:e[13]}]):{};n.$set(o);const s=7184&a?_e(h,[{panoIndex:e[4],floorplanData:e[10],lastPanoramaLongitude:e[11],cameraImageUrl:e[12]}]):{};i.$set(s),e[7]?f?(f.p(e,a),128&a&&me(f,1)):(f=vn(e),f.c(),me(f,1),f.m(t,null)):f&&(de(),ve(f,1,1,(()=>{f=null})),fe())},i(r){s||(me(n.$$.fragment,r),me(i.$$.fragment,r),me(f),o||ie((()=>{o=ye(t,tt,{duration:e[2],easing:u}),o.start()})),s=!0)},o(e){ve(n.$$.fragment,e),ve(i.$$.fragment,e),ve(f),s=!1},d(e){e&&L(t),Ee(n),Ee(i),f&&f.d()}}}function vn(e){let t,n;return t=new et({props:{floorplanData:e[10]}}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};1024&n&&(r.floorplanData=e[10]),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function gn(e){let t,n,r=e[3]&&mn(e);return{c(){r&&r.c(),t=O()},m(e,i){r&&r.m(e,i),P(e,t,i),n=!0},p(e,[n]){e[3]?r?(r.p(e,n),8&n&&me(r,1)):(r=mn(e),r.c(),me(r,1),r.m(t.parentNode,t)):r&&(de(),ve(r,1,1,(()=>{r=null})),fe())},i(e){n||(me(r),n=!0)},o(e){ve(r),n=!1},d(e){r&&r.d(e),e&&L(t)}}}function yn(e,t,n){let{pxmm:r}=t,{five:i}=t,{duration:a=0}=t,{visible:o}=t,{panoIndex:s}=t,{floorIndex:l}=t,{hoverEnable:c}=t,{compassEnable:h}=t,{roomLabelsEnable:u}=t,{ruleLabelsEnable:p}=t,{floorplanData:d}=t,{lastPanoramaLongitude:f}=t,{cameraImageUrl:m}=t,{onRoomHeightClick:v}=t,{getLabelElement:g}=t;return e.$$set=e=>{"pxmm"in e&&n(0,r=e.pxmm),"five"in e&&n(1,i=e.five),"duration"in e&&n(2,a=e.duration),"visible"in e&&n(3,o=e.visible),"panoIndex"in e&&n(4,s=e.panoIndex),"floorIndex"in e&&n(5,l=e.floorIndex),"hoverEnable"in e&&n(6,c=e.hoverEnable),"compassEnable"in e&&n(7,h=e.compassEnable),"roomLabelsEnable"in e&&n(8,u=e.roomLabelsEnable),"ruleLabelsEnable"in e&&n(9,p=e.ruleLabelsEnable),"floorplanData"in e&&n(10,d=e.floorplanData),"lastPanoramaLongitude"in e&&n(11,f=e.lastPanoramaLongitude),"cameraImageUrl"in e&&n(12,m=e.cameraImageUrl),"onRoomHeightClick"in e&&n(13,v=e.onRoomHeightClick),"getLabelElement"in e&&n(14,g=e.getLabelElement)},[r,i,a,o,s,l,c,h,u,p,d,f,m,v,g]}class xn extends Pe{constructor(e){super(),Ae(this,e,yn,gn,g,{pxmm:0,five:1,duration:2,visible:3,panoIndex:4,floorIndex:5,hoverEnable:6,compassEnable:7,roomLabelsEnable:8,ruleLabelsEnable:9,floorplanData:10,lastPanoramaLongitude:11,cameraImageUrl:12,onRoomHeightClick:13,getLabelElement:14})}}function bn(e,t,n=300){const r=e.getElement();r&&(r.style.opacity=t+"",r.style.transition=0===n?"none":`opacity ${n}ms linear`,0!==n&&Promise.race([new Promise((e=>r.addEventListener("transitionend",e,{once:!0}))),new Promise((e=>setTimeout(e,n)))]).then((()=>{r.style.transition="none"})))}class wn{constructor(e,t){__publicField(this,"size",{width:0,height:0}),__publicField(this,"visible",!1),__publicField(this,"pxmm",0),__publicField(this,"app"),__publicField(this,"five"),__publicField(this,"panoIndex",0),__publicField(this,"floorIndex",0),__publicField(this,"configs",{}),__publicField(this,"lastPanoramaLongitude",0),__publicField(this,"selector"),__publicField(this,"floorplanData"),__publicField(this,"wrapper"),__publicField(this,"container",document.createElement("div")),__publicField(this,"dispose",(()=>{var e,t;this.hide(),null==(e=this.container)||e.remove(),null==(t=this.app)||t.$destroy(),this.five.off("modeChange",this.handleModeChange),this.five.off("panoArrived",this.handlePanoArrived),this.five.off("modelLoaded",this.handleModelLoaded),this.five.off("wantsMoveToPano",this.handleWantsMoveToPano),this.five.off("wantsPanGesture",this.handleWantsPanGesture),this.five.off("initAnimationEnded",this.handleInitAnimationEnded),this.five.off("modelShownFloorChange",this.onModelShownFloorChange)})),__publicField(this,"onModelShownFloorChange",(e=>{null!==e&&(this.floorIndex=e,this.render())})),__publicField(this,"handlePanoArrived",(e=>{var t;(null==(t=this.five)?void 0:t.work)&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)})),__publicField(this,"handleWantsMoveToPano",(()=>{if(this.visible)return!this.configs.preventRoomClick&&void 0})),__publicField(this,"handleWantsPanGesture",(()=>{if(this.visible)return!1})),__publicField(this,"handleModelLoaded",(()=>{if(this.wrapper)return;if(!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)})),__publicField(this,"handleModeChange",(e=>{if("Topview"!==e)return this.hide()})),__publicField(this,"handleInitAnimationEnded",(()=>{const{mode:e}=this.five.getCurrentState();"Topview"===e&&this.show()})),__publicField(this,"updateSize",(()=>{if(!this.floorplanData)return;if(!this.container||!this.wrapper)return;if("Topview"!==this.five.getCurrentState().mode)return;const{min:e,max:t}=this.floorplanData.bounding,n=t.x-e.x,r=t.y-e.y,i=Xe(this.five,this.wrapper),a=Math.ceil(n*i),o=Math.ceil(r*i);this.pxmm=i,this.size={width:a,height:o},this.container.style.width=a+"px",this.container.style.height=o+"px"})),this.five=e,this.selector=t.selector,this.configs=qe(t,["selector"]),this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,Ue),this.five.model.loaded?this.handleModelLoaded():e.once("modelLoaded",this.handleModelLoaded),this.five.once("dispose",this.dispose),this.five.on("modeChange",this.handleModeChange),this.five.on("panoArrived",this.handlePanoArrived),this.five.on("initAnimationEnded",this.handleInitAnimationEnded),this.five.on("modelShownFloorChange",this.onModelShownFloorChange)}async load(e){const t=JSON.parse(JSON.stringify(e));this.floorplanData=await Ve(t),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this}show(){this.visible=!0,this.updateSize(),this.five.model.show(this.floorIndex);const e=this.configs.modelOpacity;"number"==typeof e&&bn(this.five,e,500),this.render(500),this.five.on("wantsMoveToPano",this.handleWantsMoveToPano),this.five.on("wantsPanGesture",this.handleWantsPanGesture)}hide(){this.visible=!1,bn(this.five,1,0),this.render(),this.five.on("wantsMoveToPano",this.handleWantsMoveToPano),this.five.on("wantsPanGesture",this.handleWantsPanGesture)}render(e){if(!this.container||!this.floorplanData)return;if(0===this.size.width)return;const{getLabelElement:t,cameraImageUrl:n,preventRoomClick:r,hoverEnable:i,compassEnable:a,roomLabelsEnable:o,ruleLabelsEnable:s}=this.configs,l=r?()=>!1:void 0;console.log("🚀 ~ TopviewFloorplanPluginController ~ handleClick",l);const c={five:this.five,pxmm:this.pxmm,cameraImageUrl:n,visible:this.visible,duration:null!=e?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.floorplanData,hoverEnable:null!=i&&i,compassEnable:null==a||a,ruleLabelsEnable:null==s||s,roomLabelsEnable:null==o||o,lastPanoramaLongitude:this.lastPanoramaLongitude,getLabelElement:t,onRoomHeightClick:l};this.app?this.app.$set(c):this.app=new xn({target:this.container,intro:!0,props:c})}}function _n(e,t=200){let n;return function(...r){n||(e(...r),n=setTimeout((function(){n=null}),t))}}function Mn(e){let t,n,r;return{c(){t=R("div"),n=R("div"),r=R("div"),F(r,"class","plugin-radar__camera-rotate svelte-o7uo2v"),U(r,"background-image","url("+(e[0]||Ye)+")"),U(r,"transform",e[1],!1),F(n,"class","plugin-radar__camera-position svelte-o7uo2v"),U(n,"transform",e[2],!1),F(t,"class","plugin-radar__camera-wrapper svelte-o7uo2v")},m(e,i){P(e,t,i),E(t,n),E(n,r)},p(e,[t]){1&t&&U(r,"background-image","url("+(e[0]||Ye)+")"),2&t&&U(r,"transform",e[1],!1),4&t&&U(n,"transform",e[2],!1)},i:h,o:h,d(e){e&&L(t)}}}function Sn(e,t,n){let{five:r}=t,{pxmm:i}=t,{floorplanData:a}=t,{cameraImageUrl:o}=t;function s(e){const t=a.observers[e],n=a.bounding,r=(n.max.x-n.min.x)*i,o=(n.max.y-n.min.y)*i;if(!t)return"";return`translate(${Math.floor(t.positionInImage.x*r)}px, ${Math.floor(t.positionInImage.y*o)}px)`}function l(){const{longitude:e}=r.getCurrentState();return`rotate(${-1*Math.floor(e/Math.PI*180)+45}deg)`}const c=e=>{n(2,p=s(e))},h=_n((()=>{n(1,u=l())}),1e3/60);let u=l(),p=s(r.getCurrentState().panoIndex);return Z((()=>{r.on("panoWillArrive",c),r.on("cameraDirectionUpdate",h)})),$((()=>{r.off("panoWillArrive",c),r.off("cameraDirectionUpdate",h)})),e.$$set=e=>{"five"in e&&n(3,r=e.five),"pxmm"in e&&n(4,i=e.pxmm),"floorplanData"in e&&n(5,a=e.floorplanData),"cameraImageUrl"in e&&n(0,o=e.cameraImageUrl)},[o,u,p,r,i,a]}class En extends Pe{constructor(e){super(),Ae(this,e,Sn,Mn,g,{five:3,pxmm:4,floorplanData:5,cameraImageUrl:0})}}function Tn(e,t,n){const r=e.slice();return r[1]=t[n],r}function An(e,t){let n,r,i,a=t[1].icon.width/16+"rem",o=t[1].icon.height/16+"rem",s=100*t[1].positionInImage.y+"%",l=100*t[1].positionInImage.x+"%";return{key:e,first:null,c(){n=R("div"),r=R("div"),i=D(),F(r,"class","plugin-pano-floorplan__extra-object-item svelte-8n0d4v"),U(r,"background-image",`url(${t[1].icon.url})`),U(r,"width",a,!1),U(r,"height",o,!1),F(n,"class","plugin-pano-floorplan__extra-object-item--position svelte-8n0d4v"),U(n,"top",s,!1),U(n,"left",l,!1),this.first=n},m(e,t){P(e,n,t),E(n,r),E(n,i)},p(e,i){t=e,1&i&&U(r,"background-image",`url(${t[1].icon.url})`),1&i&&a!==(a=t[1].icon.width/16+"rem")&&U(r,"width",a,!1),1&i&&o!==(o=t[1].icon.height/16+"rem")&&U(r,"height",o,!1),1&i&&s!==(s=100*t[1].positionInImage.y+"%")&&U(n,"top",s,!1),1&i&&l!==(l=100*t[1].positionInImage.x+"%")&&U(n,"left",l,!1)},d(e){e&&L(n)}}}function Pn(e){let t,n=[],r=new Map,i=e[0];const a=e=>e[1].id;for(let o=0;o<i.length;o+=1){let t=Tn(e,i,o),s=a(t);r.set(s,n[o]=An(s,t))}return{c(){t=R("div");for(let e=0;e<n.length;e+=1)n[e].c();F(t,"class","plugin-pano-floorplan__extra-objects svelte-8n0d4v")},m(e,r){P(e,t,r);for(let i=0;i<n.length;i+=1)n[i].m(t,null)},p(e,[o]){1&o&&(i=e[0],n=we(n,o,a,1,e,i,r,t,xe,An,null,Tn))},i:h,o:h,d(e){e&&L(t);for(let t=0;t<n.length;t+=1)n[t].d()}}}function Ln(e,t,n){let{extraObjects:r=[]}=t;return e.$$set=e=>{"extraObjects"in e&&n(0,r=e.extraObjects)},[r]}class Rn extends Pe{constructor(e){super(),Ae(this,e,Ln,Pn,g,{extraObjects:0})}}function Cn(e){let t,n;const r=[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[6]}];let i={};for(let a=0;a<r.length;a+=1)i=p(i,r[a]);return t=new ln({props:i}),{c(){Me(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const i=87&n?_e(r,[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[6]}]):{};t.$set(i)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ve(t.$$.fragment,e),n=!1},d(e){Ee(t,e)}}}function In(e){let t,n,r,i,a,o;const s=[{floorIndex:e[2],floorplanData:e[4]}];let l={};for(let h=0;h<s.length;h+=1)l=p(l,s[h]);t=new Ft({props:l}),r=new Rn({props:{extraObjects:e[5]}});let c=e[3]&&Cn(e);return{c(){Me(t.$$.fragment),n=D(),Me(r.$$.fragment),i=D(),c&&c.c(),a=O()},m(e,s){Se(t,e,s),P(e,n,s),Se(r,e,s),P(e,i,s),c&&c.m(e,s),P(e,a,s),o=!0},p(e,[n]){const i=20&n?_e(s,[{floorIndex:e[2],floorplanData:e[4]}]):{};t.$set(i);const o={};32&n&&(o.extraObjects=e[5]),r.$set(o),e[3]?c?(c.p(e,n),8&n&&me(c,1)):(c=Cn(e),c.c(),me(c,1),c.m(a.parentNode,a)):c&&(de(),ve(c,1,1,(()=>{c=null})),fe())},i(e){o||(me(t.$$.fragment,e),me(r.$$.fragment,e),me(c),o=!0)},o(e){ve(t.$$.fragment,e),ve(r.$$.fragment,e),ve(c),o=!1},d(e){Ee(t,e),e&&L(n),Ee(r,e),e&&L(i),c&&c.d(e),e&&L(a)}}}function Dn(e,t,n){let r,{five:i}=t,{pxmm:a}=t,{floorIndex:o}=t,{hoverEnable:s}=t,{floorplanData:l}=t,{extraObjects:c=[]}=t;return e.$$set=e=>{"five"in e&&n(0,i=e.five),"pxmm"in e&&n(1,a=e.pxmm),"floorIndex"in e&&n(2,o=e.floorIndex),"hoverEnable"in e&&n(3,s=e.hoverEnable),"floorplanData"in e&&n(4,l=e.floorplanData),"extraObjects"in e&&n(7,c=e.extraObjects)},e.$$.update=()=>{132&e.$$.dirty&&n(5,r=null==c?void 0:c.filter((e=>e.floorIndex===o)))},[i,a,o,s,l,r,void 0,c]}class On extends Pe{constructor(e){super(),Ae(this,e,Dn,In,g,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:7})}}function Nn(e){let t,n,r,i,a,o=`${e[7]}px`,s=`${e[10]}px`;const l=[{five:e[0],pxmm:e[8],floorIndex:e[9],floorplanData:e[2],hoverEnable:e[1],extraObjects:e[4]}];let c={};for(let d=0;d<l.length;d+=1)c=p(c,l[d]);n=new On({props:c});const h=[{pxmm:e[8],five:e[0],floorplanData:e[2],cameraImageUrl:e[3]}];let u={};for(let d=0;d<h.length;d+=1)u=p(u,h[d]);return i=new En({props:u}),{c(){t=R("div"),Me(n.$$.fragment),r=D(),Me(i.$$.fragment),F(t,"class","plugin-floorplan-radar-container svelte-7d8ub2"),U(t,"width",o,!1),U(t,"height",s,!1)},m(e,o){P(e,t,o),Se(n,t,null),E(t,r),Se(i,t,null),a=!0},p(e,r){const a=791&r?_e(l,[{five:e[0],pxmm:e[8],floorIndex:e[9],floorplanData:e[2],hoverEnable:e[1],extraObjects:e[4]}]):{};n.$set(a);const c=269&r?_e(h,[{pxmm:e[8],five:e[0],floorplanData:e[2],cameraImageUrl:e[3]}]):{};i.$set(c),128&r&&o!==(o=`${e[7]}px`)&&U(t,"width",o,!1),1024&r&&s!==(s=`${e[10]}px`)&&U(t,"height",s,!1)},i(e){a||(me(n.$$.fragment,e),me(i.$$.fragment,e),a=!0)},o(e){ve(n.$$.fragment,e),ve(i.$$.fragment,e),a=!1},d(e){e&&L(t),Ee(n),Ee(i)}}}function Fn(e){let t,n,r,i=0!==e[5]&&Nn(e);return{c(){t=R("div"),i&&i.c(),F(t,"class","plugin-floorplan-radar svelte-7d8ub2"),ie((()=>e[11].call(t)))},m(a,o){P(a,t,o),i&&i.m(t,null),n=k(t,e[11].bind(t)),r=!0},p(e,[n]){0!==e[5]?i?(i.p(e,n),32&n&&me(i,1)):(i=Nn(e),i.c(),me(i,1),i.m(t,null)):i&&(de(),ve(i,1,1,(()=>{i=null})),fe())},i(e){r||(me(i),r=!0)},o(e){ve(i),r=!1},d(e){e&&L(t),i&&i.d(),n()}}}function zn(e,t,n){let{five:r}=t,{hoverEnable:i}=t,{floorplanData:a}=t,{cameraImageUrl:o}=t,{extraObjects:s=[]}=t,l=0,c=0,h=0,u=0,p=0,d=0;function f(e){n(9,c=r.work.observers[e].floorIndex)}return Z((()=>(r.on("panoArrived",f),()=>{r.off("panoArrived",f)}))),e.$$set=e=>{"five"in e&&n(0,r=e.five),"hoverEnable"in e&&n(1,i=e.hoverEnable),"floorplanData"in e&&n(2,a=e.floorplanData),"cameraImageUrl"in e&&n(3,o=e.cameraImageUrl),"extraObjects"in e&&n(4,s=e.extraObjects)},e.$$.update=()=>{if(228&e.$$.dirty){const e=Math.min(h,u),{max:t,min:r}=a.bounding,i=t.x-r.x,o=t.y-r.y,s=i>o?[e,e/i*o]:[e/o*i,e];n(7,p=s[0]),n(10,d=s[1]),n(8,l=p/i)}},[r,i,a,o,s,h,u,p,l,c,d,function(){h=this.clientWidth,u=this.clientHeight,n(5,h),n(6,u)}]}class Un extends Pe{constructor(e){super(),Ae(this,e,zn,Fn,g,{five:0,hoverEnable:1,floorplanData:2,cameraImageUrl:3,extraObjects:4})}}class Bn{constructor(e,t){__publicField(this,"app"),__publicField(this,"five"),__publicField(this,"wrapperSelector",""),__publicField(this,"data"),__publicField(this,"wrapper",null),__publicField(this,"extraObjects"),__publicField(this,"originExtraObjects"),__publicField(this,"configs",{}),__publicField(this,"dispose",(()=>{var e;null==(e=this.app)||e.$destroy()})),__publicField(this,"load",(async e=>{const t=JSON.parse(JSON.stringify(e)),n=await Ve(t);this.data=n,this.render()})),this.five=e,(null==t?void 0:t.configs)&&Object.assign(this.configs,t.configs),"string"==typeof(null==t?void 0:t.wrapper)?this.wrapperSelector=t.wrapper:(null==t?void 0:t.wrapper)instanceof Element&&(this.wrapper=t.wrapper),e.once("dispose",this.dispose)}appendTo(e){this.wrapper=e,this.render()}changeConfigs(e){Object.assign(this.configs,e),this.render()}setExtraObjectsWith3DPositions(e){this.originExtraObjects=e,this.data&&(this.extraObjects=We(e,this.five,this.data),this.render())}render(){var e;if(!this.wrapper){const e=document.querySelector(this.wrapperSelector);this.wrapper=e}if(!this.data||!this.wrapper)return;!this.extraObjects&&this.originExtraObjects&&(this.extraObjects=We(this.originExtraObjects,this.five,this.data));const t={five:this.five,floorplanData:this.data,extraObjects:this.extraObjects,cameraImageUrl:this.configs.cameraImageUrl,hoverEnable:null!=(e=this.configs.hoverEnable)&&e};this.app?this.app.$set(t):this.app=new Un({target:this.wrapper,props:t})}}async function kn(e){try{return[null,await e]}catch(t){return t instanceof Error?[t,null]:[new Error(""),null]}}function Gn(e){return"[object Object]"===Object.prototype.toString.call(e)}function Hn(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function jn(e,t){return!!Hn(e,t)||(Gn(e)&&Gn(t)?function(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let i=0,a=n.length;i<a;i++){const r=n[i];if(!Hn(e[r],t[r]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(!Hn(e[n],t[n]))return!1;return!0}(e,t))}function Vn(e,t){return!!Hn(e,t)||(Gn(e)&&Gn(t)?function(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let i=0,a=n.length;i<a;i++){const r=n[i];if(!Vn(e[r],t[r]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(!Vn(e[n],t[n]))return!1;return!0}(e,t))}var Wn=(e=>(e.UnknownError="UnknowError",e.DataNotLoaded="DataNotLoaded",e.BreakOffByHide="BreakOffByHide",e.ModelNotLoaded="ModelNotLoaded",e.ChangeModeError="ChangeModeError",e.UpdateCameraError="UpdateCameraError",e.DifferentShowParams="DifferentShowParams",e))(Wn||{});function qn(e,t,n=4){return Math.floor(e*Math.pow(10,n))===Math.floor(t*Math.pow(10,n))}function Xn(e,t){if(e.currentMode!==i.Five.Mode.Floorplan)return!1;const{latitude:n,longitude:r,fov:a}=t,{latitude:o,longitude:s}=e.getCurrentState(),l=e.camera.fov;return!(!qn(n,o,1)||!qn(r,s,1)||a!==l)}async function Yn(e,t,n=!0){if(!0===Xn(e,t))return;if(e.currentMode!==i.Five.Mode.Floorplan){const[r]=await kn(async function(e,...t){const[n]=await kn(e.changeMode(...t));if(n)throw n;await new Promise(((n,r)=>{e.once("initAnimationEnded",n);const i=n=>{n!==t[0]&&r("changeMode 被中断"),e.off("modeChange",i)};e.on("modeChange",i)}))}(e,i.Five.Mode.Floorplan,t,void 0,n));if(r)throw r;if(!1===Xn(e,t))throw new Error(Wn.ChangeModeError);return}const{latitude:r,longitude:a,fov:o}=e.getCurrentState(),s=Math.min(1e3,Math.max(200,1e3*Math.abs(r-Math.PI/2),500*(a>Math.PI?2*Math.PI-a:a),10*Math.abs(o-t.fov))),[l]=await kn(e.updateCamera(t,s,n));if(l)throw new Error(Wn.UpdateCameraError)}class Jn{constructor(e,t){var n;__publicField(this,"name","modelFloorplanPlugin"),__publicField(this,"hooks"),__publicField(this,"visible",!1),__publicField(this,"size",{width:0,height:0}),__publicField(this,"app"),__publicField(this,"pxmm",0),__publicField(this,"five"),__publicField(this,"panoIndex",0),__publicField(this,"floorIndex",0),__publicField(this,"configs",{}),__publicField(this,"lastPanoramaLongitude",0),__publicField(this,"selector"),__publicField(this,"floorplanData"),__publicField(this,"wrapper"),__publicField(this,"container",document.createElement("div")),__publicField(this,"showState"),__publicField(this,"ModelFloorplanPluginsShowOpts"),__publicField(this,"showPromise"),__publicField(this,"showRejection"),__publicField(this,"dispose",(()=>{var e,t;const n=this.five;this.hide(),null==(e=this.app)||e.$destroy(),null==(t=this.container)||t.remove(),n.off("modelLoaded",this.handleModelLoaded),n.off("modeChange",this.handleModeChange),n.off("panGesture",this.handlePanGesture),n.off("panoArrived",this.handlePanoArrived),n.off("wantsChangeMode",this.handleWantsChangeMode),n.off("wantsInteriaPan",this.handleWantsInteriaPan),n.off("wantsTapGesture",this.handleWantsTapGesture),n.off("modelShownFloorChange",this.onModelShownFloorChange)})),__publicField(this,"updateSize",(()=>{if(!this.floorplanData)return;if(!Xn(this.five,this.showState))return;if(!this.container||!this.wrapper)return;const{min:e,max:t}=this.floorplanData.bounding,n=t.x-e.x,r=t.y-e.y,i=Xe(this.five,this.wrapper),a=Math.ceil(n*i),o=Math.ceil(r*i);this.size.width===a&&this.size.height===o||(this.pxmm=i,this.size={width:a,height:o},this.container.style.width=a+"px",this.container.style.height=o+"px")})),__publicField(this,"show",(async e=>{var t,n;if(!this.showPromise&&this.visible)return!0;if(!(null==(t=this.five.model)?void 0:t.loaded))throw new Error(Wn.ModelNotLoaded);if(!this.floorplanData)throw new Error(Wn.DataNotLoaded);if(this.visible=!0,this.showPromise){const t=function(e,t,n={deep:!1}){return n.deep?Vn(e,t):jn(e,t)}(e,this.ModelFloorplanPluginsShowOpts,{deep:!1});if(this.showPromise&&t)return this.showPromise;this.showPromise&&!t&&(null==(n=this.showRejection)||n.call(this,Wn.DifferentShowParams))}this.ModelFloorplanPluginsShowOpts=e;const r=(async()=>{var t,n;let r,i=!1;this.showRejection=e=>{i=!0,r=e};const[a]=await kn(Yn(this.five,this.showState,null==e?void 0:e.userAction));if(a)throw a;if(i)throw r?new Error(r):new Error(Wn.UnknownError);if(!this.visible)throw new Error(Wn.UnknownError);this.visible=!0,this.updateSize(),(null==e?void 0:e.floorIndex)&&(this.floorIndex=e.floorIndex),this.five.model.show(this.floorIndex);const o=null!=(n=null!=(t=null==e?void 0:e.modelOpacity)?t:this.configs.modelOpacity)?n:1,s=(null==e?void 0:e.immediately)?0:500;return bn(this.five,o,s),this.render(s),this.five.on("wantsGesture",this.handleWantsGesture),this.five.on("wantsTapGesture",this.handleWantsTapGesture),!0})().then((()=>{var t;return this.hooks.emit("showAnimationEnded",{auto:!!(null==e?void 0:e.isAutoShow),userAction:null==(t=null==e?void 0:e.userAction)||t}),!0})).catch((t=>{if(null==e?void 0:e.isAutoShow)return!1;if(!(t instanceof Error))return!1;throw t})).finally((()=>{this.showPromise=void 0,this.showRejection=void 0}));return this.showPromise=r,r})),__publicField(this,"hide",(e=>{var t,n;if(0===this.size.width)return!0;if(!1===this.visible)return!0;const r=!!(null==e?void 0:e.isAutoHide);return this.five.off("wantsGesture",this.handleWantsGesture),this.five.off("wantsTapGesture",this.handleWantsTapGesture),this.visible=!1,null==(t=this.showRejection)||t.call(this,Wn.BreakOffByHide),bn(this.five,1,0),this.render(),this.hooks.emit("hide",{auto:r,userAction:null==(n=null==e?void 0:e.userAction)||n}),!0})),__publicField(this,"onModelShownFloorChange",(e=>{null!==e&&(this.floorIndex=e,this.render())})),__publicField(this,"handleModelLoaded",(()=>{if(this.wrapper)return;if(!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)})),__publicField(this,"handleClick",(()=>{if(!this.visible)return;return!this.hooks.emit("click")&&void 0})),__publicField(this,"handleWantsTapGesture",(()=>this.handleClick())),__publicField(this,"handleWantsChangeMode",(e=>{"Panorama"!==e&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude),"Floorplan"!==e&&this.hide()})),__publicField(this,"handleModeChange",(e=>{"Floorplan"===e?this.five.on("panGesture",this.handlePanGesture):(this.hide(),this.five.off("panGesture",this.handlePanGesture))})),__publicField(this,"handlePanoArrived",(e=>{var t;(null==(t=this.five)?void 0:t.work)&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)})),__publicField(this,"handleWantsInteriaPan",(()=>{if(this.visible)return!1})),__publicField(this,"handleWantsGesture",((e,t)=>{if(this.visible)return!(t.length>1)&&("mouseWheel"!==e&&void 0)})),__publicField(this,"handlePanGesture",(async({latitude:e,longitude:t},n)=>{if(!1===this.configs.autoShowEnable)return;if(n&&this.visible)return this.five.setState(this.showState,!0);const r=Math.abs(e-Math.PI/2)>5*Math.PI/180,i=t>Math.PI/180*5&&t<Math.PI/180*355,a=r||i;if(this.visible&&a)return this.hide({isAutoHide:!0});if(this.five.camera.fov/80<.8)return;const o=Math.abs(e-Math.PI/2)<10*Math.PI/180,s=t<Math.PI/180*30||t>Math.PI/180*330;if(n&&!this.visible&&o&&s){const e=async(t,n)=>{n&&(this.five.off("interiaPan",e),await this.show({isAutoShow:!0}))};this.five.on("interiaPan",e)}else;})),this.five=e,this.hooks=new i.Subscribe,this.selector=t.selector,this.configs=qe(t,["selector"]),this.showState={longitude:0,latitude:Math.PI/2,fov:80/(null!=(n=null==t?void 0:t.scale)?n:1)},this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10}),this.five.model.loaded?this.handleModelLoaded():e.once("modelLoaded",this.handleModelLoaded),e.once("dispose",this.dispose),e.on("modeChange",this.handleModeChange),e.on("panGesture",this.handlePanGesture),e.on("panoArrived",this.handlePanoArrived),e.on("wantsChangeMode",this.handleWantsChangeMode),e.on("wantsInteriaPan",this.handleWantsInteriaPan),e.on("modelShownFloorChange",this.onModelShownFloorChange)}async load(e){const t=JSON.parse(JSON.stringify(e));this.floorplanData=await Ve(t),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this}changeFloor(e){this.five.model.show(e),this.floorIndex=e,this.render()}changeConfigs(e){Object.assign(this.configs,e),this.container&&this.render()}render(e){if(!this.container||!this.floorplanData)return;if(0===this.size.width)return;const{hoverEnable:t,cameraImageUrl:n,getLabelElement:r,roomLabelsEnable:i,compassEnable:a,ruleLabelsEnable:o}=this.configs,s={five:this.five,pxmm:this.pxmm,cameraImageUrl:n,visible:this.visible,duration:null!=e?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.floorplanData,hoverEnable:null!=t&&t,compassEnable:null==a||a,ruleLabelsEnable:null==o||o,roomLabelsEnable:null==i||i,lastPanoramaLongitude:this.lastPanoramaLongitude,getLabelElement:r,onRoomHeightClick:this.handleClick};this.app?this.app.$set(s):this.app=new xn({target:this.container,intro:!0,props:s})}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let n=1;n<arguments.length;n++){const e=arguments[n];if(null!=e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t});const Zn=100,$n=306,Qn=1e3,Kn=1001,er=1002,tr=1003,nr=1004,rr=1005,ir=1006,ar=1008,or=1009,sr=1012,lr=1014,cr=1015,hr=1016,ur=1020,pr=1022,dr=1023,fr=1026,mr=1027,vr=2300,gr=2301,yr=2302,xr=2400,br=2401,wr=2402,_r=2500,Mr=3e3,Sr=3001,Er=7680,Tr=35044,Ar=35048;function Pr(){}Object.assign(Pr.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}});for(var Lr=[],Rr=0;Rr<256;Rr++)Lr[Rr]=(Rr<16?"0":"")+Rr.toString(16);var Cr,Ir={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Lr[255&e]+Lr[e>>8&255]+Lr[e>>16&255]+Lr[e>>24&255]+"-"+Lr[255&t]+Lr[t>>8&255]+"-"+Lr[t>>16&15|64]+Lr[t>>24&255]+"-"+Lr[63&n|128]+Lr[n>>8&255]+"-"+Lr[n>>16&255]+Lr[n>>24&255]+Lr[255&r]+Lr[r>>8&255]+Lr[r>>16&255]+Lr[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Ir.DEG2RAD},radToDeg:function(e){return e*Ir.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+r)/2),h=o((t+r)/2),u=a((t-r)/2),p=o((t-r)/2),d=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*h,l*u,l*p,s*c);break;case"YZY":e.set(l*p,s*h,l*u,s*c);break;case"ZXZ":e.set(l*u,l*p,s*h,s*c);break;case"XZX":e.set(s*h,l*f,l*d,s*c);break;case"YXY":e.set(l*d,s*h,l*f,s*c);break;case"ZYZ":e.set(l*f,l*d,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};function Dr(e,t){this.x=e||0,this.y=t||0}function Or(){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.")}Object.defineProperties(Dr.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Dr.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Or.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=r,c[2]=o,c[3]=t,c[4]=i,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=a*f+o*g+s*b,i[3]=a*m+o*y+s*w,i[6]=a*v+o*x+s*_,i[1]=l*f+c*g+h*b,i[4]=l*m+c*y+h*w,i[7]=l*v+c*x+h*_,i[2]=u*f+p*g+d*b,i[5]=u*m+p*y+d*w,i[8]=u*v+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*i*c+n*o*s+r*i*l-r*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],h=n[6],u=n[7],p=n[8],d=p*l-c*u,f=c*h-p*s,m=u*s-l*h,v=i*d+a*f+o*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return r[0]=d*g,r[1]=(o*u-p*a)*g,r[2]=(c*a-o*l)*g,r[3]=f*g,r[4]=(p*i-o*h)*g,r[5]=(o*s-c*i)*g,r[6]=m*g,r[7]=(a*h-u*i)*g,r[8]=(l*i-a*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],c=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*c,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Nr={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Cr&&(Cr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Cr.width=e.width,Cr.height=e.height;var n=Cr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Cr}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Fr=0;function zr(e,t,n,r,i,a,o,s,l,c){Object.defineProperty(this,"id",{value:Fr++}),this.uuid=Ir.generateUUID(),this.name="",this.image=void 0!==e?e:zr.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:zr.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Kn,this.wrapT=void 0!==r?r:Kn,this.magFilter=void 0!==i?i:ir,this.minFilter=void 0!==a?a:ar,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:dr,this.internalFormat=null,this.type=void 0!==s?s:or,this.offset=new Dr(0,0),this.repeat=new Dr(1,1),this.center=new Dr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Or,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Mr,this.version=0,this.onUpdate=null}function Ur(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function Br(e,t,n){this.width=e,this.height=t,this.scissor=new Ur(0,0,e,t),this.scissorTest=!1,this.viewport=new Ur(0,0,e,t),n=n||{},this.texture=new zr(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:ir,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}function kr(e,t,n){Br.call(this,e,t,n),this.samples=4}function Gr(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}zr.DEFAULT_IMAGE=void 0,zr.DEFAULT_MAPPING=300,zr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:zr,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var 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){var r=this.image;if(void 0===r.uuid&&(r.uuid=Ir.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(Nr.getDataURL(r[a]))}else i=Nr.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qn:e.x=e.x-Math.floor(e.x);break;case Kn:e.x=e.x<0?0:1;break;case er:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Qn:e.y=e.y-Math.floor(e.y);break;case Kn:e.y=e.y<0?0:1;break;case er:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(zr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Ur.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Ur.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,l=s[0],c=s[4],h=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-u)<a&&Math.abs(h-f)<a&&Math.abs(d-m)<a){if(Math.abs(c+u)<o&&Math.abs(h+f)<o&&Math.abs(d+m)<o&&Math.abs(l+p+v-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(p+1)/2,x=(v+1)/2,b=(c+u)/4,w=(h+f)/4,_=(d+m)/4;return g>y&&g>x?g<a?(n=0,r=.707106781,i=.707106781):(r=b/(n=Math.sqrt(g)),i=w/n):y>x?y<a?(n=.707106781,r=0,i=.707106781):(n=b/(r=Math.sqrt(y)),i=_/r):x<a?(n=.707106781,r=.707106781,i=0):(n=w/(i=Math.sqrt(x)),r=_/i),this.set(n,r,i,t),this}var M=Math.sqrt((m-d)*(m-d)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(h-f)/M,this.z=(u-c)/M,this.w=Math.acos((l+p+v-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){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:function(){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:function(){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:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),Br.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Br,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),kr.prototype=Object.assign(Object.create(Br.prototype),{constructor:kr,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Br.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(Gr,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3],u=i[a+0],p=i[a+1],d=i[a+2],f=i[a+3];if(h!==f||s!==u||l!==p||c!==d){var m=1-o,v=s*u+l*p+c*d+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*m+u*w,l=l*m+p*w,c=c*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=_,l*=_,c*=_,h*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],c=n[r+3],h=i[a],u=i[a+1],p=i[a+2],d=i[a+3];return e[t]=o*d+c*h+s*p-l*u,e[t+1]=s*d+c*u+l*h-o*p,e[t+2]=l*d+c*p+o*u-s*h,e[t+3]=c*d-o*h-s*u-l*p,e}}),Object.defineProperties(Gr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Gr.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=s(n/2),p=s(r/2),d=s(i/2);switch(a){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],h=n[6],u=n[10],p=r+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-l)*t,this._y=(a-c)*t,this._z=(o-i)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this._w=(h-l)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+c)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this._w=(a-c)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(o-i)/t,this._x=(a+c)/t,this._y=(l+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Ir.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+r*l-i*s,this._y=r*c+a*s+i*o-n*l,this._z=i*c+a*l+n*s-r*o,this._w=a*c-n*o-r*s-i*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=r*u+this._y*p,this._z=i*u+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Hr=new Vr,jr=new Gr;function Vr(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(Vr.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(jr.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(jr.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,c=s*n+o*t-i*r,h=s*r+i*n-a*t,u=-i*t-a*n-o*r;return this.x=l*s+u*-i+c*-o-h*-a,this.y=c*s+u*-a+h*-i-l*-o,this.z=h*s+u*-o+l*-a-c*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Hr.copy(this).projectOnVector(e),this.sub(Hr)},reflect:function(e){return this.sub(Hr.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Ir.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Wr=new Vr,qr=new Qr,Xr=new Vr(0,0,0),Yr=new Vr(1,1,1),Jr=new Vr,Zr=new Vr,$r=new Vr;function Qr(){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.")}Object.assign(Qr.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,l,c,h,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=h,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Qr).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/Wr.setFromMatrixColumn(e,0).length(),i=1/Wr.setFromMatrixColumn(e,1).length(),a=1/Wr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===e.order){var u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=p+d*l,t[5]=u-f*l,t[9]=-o*s,t[2]=f-u*l,t[6]=d+p*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m-y*o,t[4]=-a*h,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=d*l-p,t[8]=u*l+f,t[1]=s*h,t[5]=f*l+u,t[9]=p*l-d,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=x*h+_,t[5]=a*c,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*c,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Xr,e,Yr)},lookAt:function(e,t,n){var r=this.elements;return $r.subVectors(e,t),0===$r.lengthSq()&&($r.z=1),$r.normalize(),Jr.crossVectors(n,$r),0===Jr.lengthSq()&&(1===Math.abs(n.z)?$r.x+=1e-4:$r.z+=1e-4,$r.normalize(),Jr.crossVectors(n,$r)),Jr.normalize(),Zr.crossVectors($r,Jr),r[0]=Jr.x,r[4]=Zr.x,r[8]=$r.x,r[1]=Jr.y,r[5]=Zr.y,r[9]=$r.y,r[2]=Jr.z,r[6]=Zr.z,r[10]=$r.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],S=r[12],E=r[1],T=r[5],A=r[9],P=r[13],L=r[2],R=r[6],C=r[10],I=r[14],D=r[3],O=r[7],N=r[11],F=r[15];return i[0]=a*w+o*E+s*L+l*D,i[4]=a*_+o*T+s*R+l*O,i[8]=a*M+o*A+s*C+l*N,i[12]=a*S+o*P+s*I+l*F,i[1]=c*w+h*E+u*L+p*D,i[5]=c*_+h*T+u*R+p*O,i[9]=c*M+h*A+u*C+p*N,i[13]=c*S+h*P+u*I+p*F,i[2]=d*w+f*E+m*L+v*D,i[6]=d*_+f*T+m*R+v*O,i[10]=d*M+f*A+m*C+v*N,i[14]=d*S+f*P+m*I+v*F,i[3]=g*w+y*E+x*L+b*D,i[7]=g*_+y*T+x*R+b*O,i[11]=g*M+y*A+x*C+b*N,i[15]=g*S+y*P+x*I+b*F,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(+i*s*h-r*l*h-i*o*u+n*l*u+r*o*p-n*s*p)+e[7]*(+t*s*p-t*l*u+i*a*u-r*a*p+r*l*c-i*s*c)+e[11]*(+t*l*h-t*o*p-i*a*h+n*a*p+i*o*c-n*l*c)+e[15]*(-r*o*c-t*s*h+t*o*u+r*a*h-n*a*u+n*s*c)},transpose:function(){var e,t=this.elements;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:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],c=r[5],h=r[6],u=r[7],p=r[8],d=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],b=d*y*u-g*f*u+g*h*m-c*y*m-d*h*x+c*f*x,w=v*f*u-p*y*u-v*h*m+l*y*m+p*h*x-l*f*x,_=p*g*u-v*d*u+v*c*m-l*g*m-p*c*x+l*d*x,M=v*d*h-p*g*h-v*c*f+l*g*f+p*c*y-l*d*y,S=i*b+a*w+o*_+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/S;return n[0]=b*E,n[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*E,n[2]=(c*y*s-g*h*s+g*o*u-a*y*u-c*o*x+a*h*x)*E,n[3]=(d*h*s-c*f*s-d*o*u+a*f*u+c*o*m-a*h*m)*E,n[4]=w*E,n[5]=(p*y*s-v*f*s+v*o*m-i*y*m-p*o*x+i*f*x)*E,n[6]=(v*h*s-l*y*s-v*o*u+i*y*u+l*o*x-i*h*x)*E,n[7]=(l*f*s-p*h*s+p*o*u-i*f*u-l*o*m+i*h*m)*E,n[8]=_*E,n[9]=(v*d*s-p*g*s-v*a*m+i*g*m+p*a*x-i*d*x)*E,n[10]=(l*g*s-v*c*s+v*a*u-i*g*u-l*a*x+i*c*x)*E,n[11]=(p*c*s-l*d*s-p*a*u+i*d*u+l*a*m-i*c*m)*E,n[12]=M*E,n[13]=(p*g*o-v*d*o+v*a*f-i*g*f-p*a*y+i*d*y)*E,n[14]=(v*c*o-l*g*o-v*a*h+i*g*h+l*a*y-i*c*y)*E,n[15]=(l*d*o-p*c*o+p*a*h-i*d*h-l*a*f+i*c*f)*E,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,c=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,c*o+n,c*s-r*a,0,l*s-r*o,c*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,c=a+a,h=o+o,u=i*l,p=i*c,d=i*h,f=a*c,m=a*h,v=o*h,g=s*l,y=s*c,x=s*h,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+v))*b,r[1]=(p+x)*b,r[2]=(d-y)*b,r[3]=0,r[4]=(p-x)*w,r[5]=(1-(u+v))*w,r[6]=(m+g)*w,r[7]=0,r[8]=(d+y)*_,r[9]=(m-g)*_,r[10]=(1-(u+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=Wr.set(r[0],r[1],r[2]).length(),a=Wr.set(r[4],r[5],r[6]).length(),o=Wr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],qr.copy(this);var s=1/i,l=1/a,c=1/o;return qr.elements[0]*=s,qr.elements[1]*=s,qr.elements[2]*=s,qr.elements[4]*=l,qr.elements[5]*=l,qr.elements[6]*=l,qr.elements[8]*=c,qr.elements[9]*=c,qr.elements[10]*=c,t.setFromRotationMatrix(qr),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),h=(n+r)/(n-r),u=-(a+i)/(a-i),p=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),c=1/(a-i),h=(t+e)*s,u=(n+r)*l,p=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var Kr=new Qr,ei=new Gr;function ti(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||ti.DefaultOrder}function ni(){this.mask=1}ti.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ti.DefaultOrder="XYZ",Object.defineProperties(ti.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(ti.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=Ir.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Kr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Kr,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return ei.setFromEuler(this),this.setFromQuaternion(ei,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Vr(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(ni.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let ri=0;const ii=new Vr,ai=new Gr,oi=new Qr,si=new Vr,li=new Vr,ci=new Vr,hi=new Gr,ui=new Vr(1,0,0),pi=new Vr(0,1,0),di=new Vr(0,0,1),fi={type:"added"},mi={type:"removed"};function vi(){Object.defineProperty(this,"id",{value:ri++}),this.uuid=Ir.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=vi.DefaultUp.clone();var e=new Vr,t=new ti,n=new Gr,r=new Vr(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Qr},normalMatrix:{value:new Or}}),this.matrix=new Qr,this.matrixWorld=new Qr,this.matrixAutoUpdate=vi.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ni,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function gi(){vi.call(this),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}))}vi.DefaultUp=new Vr(0,1,0),vi.DefaultMatrixAutoUpdate=!0,vi.prototype=Object.assign(Object.create(Pr.prototype),{constructor:vi,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.multiply(ai),this},rotateOnWorldAxis:function(e,t){return ai.setFromAxisAngle(e,t),this.quaternion.premultiply(ai),this},rotateX:function(e){return this.rotateOnAxis(ui,e)},rotateY:function(e){return this.rotateOnAxis(pi,e)},rotateZ:function(e){return this.rotateOnAxis(di,e)},translateOnAxis:function(e,t){return ii.copy(e).applyQuaternion(this.quaternion),this.position.add(ii.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(ui,e)},translateY:function(e){return this.translateOnAxis(pi,e)},translateZ:function(e){return this.translateOnAxis(di,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(oi.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?si.copy(e):si.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),li.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?oi.lookAt(li,si,this.up):oi.lookAt(si,li,this.up),this.quaternion.setFromRotationMatrix(oi),r&&(oi.extractRotation(r.matrixWorld),ai.setFromRotationMatrix(oi),this.quaternion.premultiply(ai.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(fi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(mi)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),oi.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),oi.multiply(e.parent.matrixWorld)),e.applyMatrix4(oi),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Vr),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Gr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(li,e,ci),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Vr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(li,hi,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Vr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&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===t)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];i(e.shapes,c)}else i(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,l=this.material.length;s<l;s++)h.push(i(e.materials,this.material[s]));r.material=h}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);o=m(e.shapes);u.length>0&&(n.geometries=u),p.length>0&&(n.materials=p),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=r,n;function m(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),gi.prototype=Object.assign(Object.create(vi.prototype),{constructor:gi,isScene:!0,copy:function(e,t){return vi.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=vi.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var yi=[new Vr,new Vr,new Vr,new Vr,new Vr,new Vr,new Vr,new Vr],xi=new Vr,bi=new Ci,wi=new Vr,_i=new Vr,Mi=new Vr,Si=new Vr,Ei=new Vr,Ti=new Vr,Ai=new Vr,Pi=new Vr,Li=new Vr,Ri=new Vr;function Ci(e,t){this.min=void 0!==e?e:new Vr(1/0,1/0,1/0),this.max=void 0!==t?t:new Vr(-1/0,-1/0,-1/0)}function Ii(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){Ri.fromArray(e,a);var s=i.x*Math.abs(Ri.x)+i.y*Math.abs(Ri.y)+i.z*Math.abs(Ri.z),l=t.dot(Ri),c=n.dot(Ri),h=r.dot(Ri);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>s)return!1}return!0}Object.assign(Ci.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],h=e[s+1],u=e[s+2];c<t&&(t=c),h<n&&(n=h),u<r&&(r=u),c>i&&(i=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),h=e.getY(s),u=e.getZ(s);c<t&&(t=c),h<n&&(n=h),u<r&&(r=u),c>i&&(i=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=xi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Vr),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Vr),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),bi.copy(t.boundingBox),bi.applyMatrix4(e.matrixWorld),this.union(bi));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Vr),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,xi),xi.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Ai),Pi.subVectors(this.max,Ai),wi.subVectors(e.a,Ai),_i.subVectors(e.b,Ai),Mi.subVectors(e.c,Ai),Si.subVectors(_i,wi),Ei.subVectors(Mi,_i),Ti.subVectors(wi,Mi);var t=[0,-Si.z,Si.y,0,-Ei.z,Ei.y,0,-Ti.z,Ti.y,Si.z,0,-Si.x,Ei.z,0,-Ei.x,Ti.z,0,-Ti.x,-Si.y,Si.x,0,-Ei.y,Ei.x,0,-Ti.y,Ti.x,0];return!!Ii(t,wi,_i,Mi,Pi)&&(!!Ii(t=[1,0,0,0,1,0,0,0,1],wi,_i,Mi,Pi)&&(Li.crossVectors(Si,Ei),Ii(t=[Li.x,Li.y,Li.z],wi,_i,Mi,Pi)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Vr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return xi.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(xi).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yi)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Di=new Ci;function Oi(e,t){this.center=void 0!==e?e:new Vr,this.radius=void 0!==t?t:-1}Object.assign(Oi.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):Di.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Vr),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Ci),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Ni=new Vr,Fi=new Vr,zi=new Vr,Ui=new Vr,Bi=new Vr,ki=new Vr,Gi=new Vr;function Hi(e,t){this.origin=void 0!==e?e:new Vr,this.direction=void 0!==t?t:new Vr(0,0,-1)}Object.assign(Hi.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Vr),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Ni)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Vr),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Ni.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ni.copy(this.direction).multiplyScalar(t).add(this.origin),Ni.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){Fi.copy(e).add(t).multiplyScalar(.5),zi.copy(t).sub(e).normalize(),Ui.copy(this.origin).sub(Fi);var i,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(zi),h=Ui.dot(this.direction),u=-Ui.dot(zi),p=Ui.lengthSq(),d=Math.abs(1-c*c);if(d>0)if(a=c*h-u,s=l*d,(i=c*u-h)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(i*=f)*(i+c*(a*=f)+2*h)+a*(c*i+a+2*u)+p}else a=l,o=-(i=Math.max(0,-(c*a+h)))*i+a*(a+2*u)+p;else a=-l,o=-(i=Math.max(0,-(c*a+h)))*i+a*(a+2*u)+p;else a<=-s?o=-(i=Math.max(0,-(-c*l+h)))*i+(a=i>0?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+p):o=-(i=Math.max(0,-(c*l+h)))*i+(a=i>0?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p;else a=c>0?-l:l,o=-(i=Math.max(0,-(c*a+h)))*i+a*(a+2*u)+p;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(zi).multiplyScalar(a).add(Fi),o},intersectSphere:function(e,t){Ni.subVectors(e.center,this.origin);var n=Ni.dot(this.direction),r=Ni.dot(Ni)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),c>=0?(i=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(i=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Ni)},intersectTriangle:function(e,t,n,r,i){Bi.subVectors(t,e),ki.subVectors(n,e),Gi.crossVectors(Bi,ki);var a,o=this.direction.dot(Gi);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Ui.subVectors(this.origin,e);var s=a*this.direction.dot(ki.crossVectors(Ui,ki));if(s<0)return null;var l=a*this.direction.dot(Bi.cross(Ui));if(l<0)return null;if(s+l>o)return null;var c=-a*Ui.dot(Gi);return c<0?null:this.at(c/o,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var ji=new Vr,Vi=new Vr,Wi=new Or;function qi(e,t){this.normal=void 0!==e?e:new Vr(1,0,0),this.constant=void 0!==t?t:0}Object.assign(qi.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=ji.subVectors(n,t).cross(Vi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Vr),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Vr);var n=e.delta(ji),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Vr),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Wi.getNormalMatrix(e),r=this.coplanarPoint(ji).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Xi=new Vr,Yi=new Vr,Ji=new Vr,Zi=new Vr,$i=new Vr,Qi=new Vr,Ki=new Vr,ea=new Vr,ta=new Vr,na=new Vr;function ra(e,t,n){this.a=void 0!==e?e:new Vr,this.b=void 0!==t?t:new Vr,this.c=void 0!==n?n:new Vr}Object.assign(ra,{getNormal:function(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Vr),r.subVectors(n,t),Xi.subVectors(e,t),r.cross(Xi);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){Xi.subVectors(r,t),Yi.subVectors(n,t),Ji.subVectors(e,t);var a=Xi.dot(Xi),o=Xi.dot(Yi),s=Xi.dot(Ji),l=Yi.dot(Yi),c=Yi.dot(Ji),h=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Vr),0===h)return i.set(-2,-1,-1);var u=1/h,p=(l*s-o*c)*u,d=(a*c-o*s)*u;return i.set(1-p-d,d,p)},containsPoint:function(e,t,n,r){return ra.getBarycoord(e,t,n,r,Zi),Zi.x>=0&&Zi.y>=0&&Zi.x+Zi.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Zi),s.set(0,0),s.addScaledVector(i,Zi.x),s.addScaledVector(a,Zi.y),s.addScaledVector(o,Zi.z),s},isFrontFacing:function(e,t,n,r){return Xi.subVectors(n,t),Yi.subVectors(e,t),Xi.cross(Yi).dot(r)<0}}),Object.assign(ra.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Xi.subVectors(this.c,this.b),Yi.subVectors(this.a,this.b),.5*Xi.cross(Yi).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Vr),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return ra.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new qi),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return ra.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return ra.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return ra.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return ra.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Vr);var n,r,i=this.a,a=this.b,o=this.c;$i.subVectors(a,i),Qi.subVectors(o,i),ea.subVectors(e,i);var s=$i.dot(ea),l=Qi.dot(ea);if(s<=0&&l<=0)return t.copy(i);ta.subVectors(e,a);var c=$i.dot(ta),h=Qi.dot(ta);if(c>=0&&h<=c)return t.copy(a);var u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(i).addScaledVector($i,n);na.subVectors(e,o);var p=$i.dot(na),d=Qi.dot(na);if(d>=0&&p<=d)return t.copy(o);var f=p*l-s*d;if(f<=0&&l>=0&&d<=0)return r=l/(l-d),t.copy(i).addScaledVector(Qi,r);var m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return Ki.subVectors(o,a),r=(h-c)/(h-c+(p-d)),t.copy(a).addScaledVector(Ki,r);var v=1/(m+f+u);return n=f*v,r=u*v,t.copy(i).addScaledVector($i,n).addScaledVector(Qi,r)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var ia={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},aa={h:0,s:0,l:0},oa={h:0,s:0,l:0};function sa(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function la(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function ca(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ha(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function ua(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new Vr,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new sa,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}Object.assign(sa.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Ir.euclideanModulo(e,1),t=Ir.clamp(t,0,1),n=Ir.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=la(i,r,e+1/3),this.g=la(i,r,e),this.b=la(i,r,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=ia[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=ca(e.r),this.g=ca(e.g),this.b=ca(e.b),this},copyLinearToSRGB:function(e){return this.r=ha(e.r),this.g=ha(e.g),this.b=ha(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case r:t=(i-a)/c+(i<a?6:0);break;case i:t=(a-r)/c+2;break;case a:t=(r-i)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(aa),aa.h+=e,aa.s+=t,aa.l+=n,this.setHSL(aa.h,aa.s,aa.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(aa),e.getHSL(oa);var n=Ir.lerp(aa.h,oa.h,t),r=Ir.lerp(aa.s,oa.s,t),i=Ir.lerp(aa.l,oa.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),sa.NAMES=ia,Object.assign(ua.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var pa=0;function da(){Object.defineProperty(this,"id",{value:pa++}),this.uuid=Ir.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Zn,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=Er,this.stencilZFail=Er,this.stencilZPass=Er,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function fa(e){da.call(this),this.type="MeshBasicMaterial",this.color=new sa(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.skinning=!1,this.morphTargets=!1,this.setValues(e)}da.prototype=Object.assign(Object.create(Pr.prototype),{constructor:da,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}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.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.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.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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,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.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.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(da.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),fa.prototype=Object.create(da.prototype),fa.prototype.constructor=fa,fa.prototype.isMeshBasicMaterial=!0,fa.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var ma=new Vr;function va(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=Tr,this.updateRange={offset:0,count:-1},this.version=0}function ga(e,t,n){va.call(this,new Int8Array(e),t,n)}function ya(e,t,n){va.call(this,new Uint8Array(e),t,n)}function xa(e,t,n){va.call(this,new Uint8ClampedArray(e),t,n)}function ba(e,t,n){va.call(this,new Int16Array(e),t,n)}function wa(e,t,n){va.call(this,new Uint16Array(e),t,n)}function _a(e,t,n){va.call(this,new Int32Array(e),t,n)}function Ma(e,t,n){va.call(this,new Uint32Array(e),t,n)}function Sa(e,t,n){va.call(this,new Float32Array(e),t,n)}function Ea(e,t,n){va.call(this,new Float64Array(e),t,n)}function Ta(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Aa(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(va.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(va.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new sa),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new Dr),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Vr),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Ur),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.applyMatrix3(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.applyMatrix4(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.applyNormalMatrix(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)ma.x=this.getX(t),ma.y=this.getY(t),ma.z=this.getZ(t),ma.transformDirection(e),this.setXYZ(t,ma.x,ma.y,ma.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),ga.prototype=Object.create(va.prototype),ga.prototype.constructor=ga,ya.prototype=Object.create(va.prototype),ya.prototype.constructor=ya,xa.prototype=Object.create(va.prototype),xa.prototype.constructor=xa,ba.prototype=Object.create(va.prototype),ba.prototype.constructor=ba,wa.prototype=Object.create(va.prototype),wa.prototype.constructor=wa,_a.prototype=Object.create(va.prototype),_a.prototype.constructor=_a,Ma.prototype=Object.create(va.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(va.prototype),Sa.prototype.constructor=Sa,Ea.prototype=Object.create(va.prototype),Ea.prototype.constructor=Ea,Object.assign(Ta.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(p>0){h=[];for(c=0;c<p;c++)h[c]={name:u[c].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===r.length,v=f.length===r.length;r.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var g=n[c];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=i[0][c])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new Dr,new Dr,new Dr));if(!0===o)void 0!==(b=i[1][c])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new Dr,new Dr,new Dr));for(var M=0;M<l;M++){var S=s[M].vertices;t[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<p;M++){var E=u[M].vertexNormals[c];h[M].data.push(E.a,E.b,E.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var Pa=1,La=new Qr,Ra=new vi,Ca=new Vr,Ia=new Ci,Da=new Ci,Oa=new Vr;function Na(){Object.defineProperty(this,"id",{value:Pa+=2}),this.uuid=Ir.generateUUID(),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={}}Na.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Na,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Aa(e)>65535?Ma:wa)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new Or).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return La.makeRotationX(e),this.applyMatrix4(La),this},rotateY:function(e){return La.makeRotationY(e),this.applyMatrix4(La),this},rotateZ:function(e){return La.makeRotationZ(e),this.applyMatrix4(La),this},translate:function(e,t,n){return La.makeTranslation(e,t,n),this.applyMatrix4(La),this},scale:function(e,t,n){return La.makeScale(e,t,n),this.applyMatrix4(La),this},lookAt:function(e){return Ra.lookAt(e),Ra.updateMatrix(),this.applyMatrix4(Ra.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ca).negate(),this.translate(Ca.x,Ca.y,Ca.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Sa(3*t.vertices.length,3),r=new Sa(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Sa(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Sa(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ta).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new va(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new va(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.setAttribute("color",new va(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new va(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new va(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,h=l.length;c<h;c++){var u=l[c],p=new Sa(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new Sa(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Sa(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ci);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Ia.setFromBufferAttribute(i),this.morphTargetsRelative?(Oa.addVectors(this.boundingBox.min,Ia.min),this.boundingBox.expandByPoint(Oa),Oa.addVectors(this.boundingBox.max,Ia.max),this.boundingBox.expandByPoint(Oa)):(this.boundingBox.expandByPoint(Ia.min),this.boundingBox.expandByPoint(Ia.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:function(){null===this.boundingSphere&&(this.boundingSphere=new Oi);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Ia.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];Da.setFromBufferAttribute(a),this.morphTargetsRelative?(Oa.addVectors(Ia.min,Da.min),Ia.expandByPoint(Oa),Oa.addVectors(Ia.max,Da.max),Ia.expandByPoint(Oa)):(Ia.expandByPoint(Da.min),Ia.expandByPoint(Da.max))}Ia.getCenter(n);var o=0;for(r=0,i=e.count;r<i;r++)Oa.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Oa));if(t)for(r=0,i=t.length;r<i;r++){a=t[r];for(var s=this.morphTargetsRelative,l=0,c=a.count;l<c;l++)Oa.fromBufferAttribute(a,l),s&&(Ca.fromBufferAttribute(e,l),Oa.add(Ca)),o=Math.max(o,n.distanceToSquared(Oa))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new va(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,l,c=t.normal.array,h=new Vr,u=new Vr,p=new Vr,d=new Vr,f=new Vr;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],l=3*m[i+2],h.fromArray(n,o),u.fromArray(n,s),p.fromArray(n,l),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[o]+=d.x,c[o+1]+=d.y,c[o+2]+=d.z,c[s]+=d.x,c[s+1]+=d.y,c[s+2]+=d.z,c[l]+=d.x,c[l+1]+=d.y,c[l+2]+=d.z}else for(i=0,a=n.length;i<a;i+=9)h.fromArray(n,i),u.fromArray(n,i+3),p.fromArray(n,i+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[i]=d.x,c[i+1]=d.y,c[i+2]=d.z,c[i+3]=d.x,c[i+4]=d.y,c[i+5]=d.z,c[i+6]=d.x,c[i+7]=d.y,c[i+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,l=Math.min(o.length,i.length-s),c=0,h=s;c<l;c++,h++)i[h]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Oa.x=e.getX(t),Oa.y=e.getY(t),Oa.z=e.getZ(t),Oa.normalize(),e.setXYZ(t,Oa.x,Oa.y,Oa.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,l=0,c=t.length;l<c;l++){o=t[l]*r;for(var h=0;h<r;h++)a[s++]=n[o++]}return new va(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Na,n=this.index.array,r=this.attributes;for(var i in r){var a=e(r[i],n);t.setAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],l=o[i],c=0,h=l.length;c<h;c++){a=e(l[c],n);s.push(a)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,p=(c=0,u.length);c<p;c++){var d=u[c];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=(p=i[n]).toJSON();""!==p.name&&(a.name=p.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],h=0,u=l.length;h<u;h++){var p;a=(p=l[h]).toJSON();""!==p.name&&(a.name=p.name),c.push(a)}c.length>0&&(o[n]=c,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Na).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,r=c.length;n<r;n++)l.push(c[n].clone());this.morphAttributes[t]=l}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(n=0,r=h.length;n<r;n++){var u=h[n];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Fa=new Qr,za=new Hi,Ua=new Oi,Ba=new Vr,ka=new Vr,Ga=new Vr,Ha=new Vr,ja=new Vr,Va=new Vr,Wa=new Vr,qa=new Vr,Xa=new Vr,Ya=new Dr,Ja=new Dr,Za=new Dr,$a=new Vr,Qa=new Vr;function Ka(e,t){vi.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Na,this.material=void 0!==t?t:new fa,this.updateMorphTargets()}function eo(e,t,n,r,i,a,o,s){if(null===(1===t.side?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,2!==t.side,s)))return null;Qa.copy(s),Qa.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(Qa);return l<n.near||l>n.far?null:{distance:l,point:Qa.clone(),object:e}}function to(e,t,n,r,i,a,o,s,l,c,h,u){Ba.fromBufferAttribute(i,c),ka.fromBufferAttribute(i,h),Ga.fromBufferAttribute(i,u);var p=e.morphTargetInfluences;if(t.morphTargets&&a&&p){Wa.set(0,0,0),qa.set(0,0,0),Xa.set(0,0,0);for(var d=0,f=a.length;d<f;d++){var m=p[d],v=a[d];0!==m&&(Ha.fromBufferAttribute(v,c),ja.fromBufferAttribute(v,h),Va.fromBufferAttribute(v,u),o?(Wa.addScaledVector(Ha,m),qa.addScaledVector(ja,m),Xa.addScaledVector(Va,m)):(Wa.addScaledVector(Ha.sub(Ba),m),qa.addScaledVector(ja.sub(ka),m),Xa.addScaledVector(Va.sub(Ga),m)))}Ba.add(Wa),ka.add(qa),Ga.add(Xa)}e.isSkinnedMesh&&(e.boneTransform(c,Ba),e.boneTransform(h,ka),e.boneTransform(u,Ga));var g=eo(e,t,n,r,Ba,ka,Ga,$a);if(g){s&&(Ya.fromBufferAttribute(s,c),Ja.fromBufferAttribute(s,h),Za.fromBufferAttribute(s,u),g.uv=ra.getUV($a,Ba,ka,Ga,Ya,Ja,Za,new Dr)),l&&(Ya.fromBufferAttribute(l,c),Ja.fromBufferAttribute(l,h),Za.fromBufferAttribute(l,u),g.uv2=ra.getUV($a,Ba,ka,Ga,Ya,Ja,Za,new Dr));var y=new ua(c,h,u);ra.getNormal(Ba,ka,Ga,y.normal),g.face=y}return g}Ka.prototype=Object.assign(Object.create(vi.prototype),{constructor:Ka,isMesh:!0,copy:function(e){return vi.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),Ua.copy(r.boundingSphere),Ua.applyMatrix4(a),!1!==e.ray.intersectsSphere(Ua)&&(Fa.getInverse(a),za.copy(e.ray).applyMatrix4(Fa),null===r.boundingBox||!1!==za.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o,s,l,c,h,u,p,d,f,m=r.index,v=r.attributes.position,g=r.morphAttributes.position,y=r.morphTargetsRelative,x=r.attributes.uv,b=r.attributes.uv2,w=r.groups,_=r.drawRange;if(null!==m)if(Array.isArray(i))for(c=0,u=w.length;c<u;c++)for(f=i[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)o=m.getX(h),s=m.getX(h+1),l=m.getX(h+2),(n=to(this,f,e,za,v,g,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(m.count,_.start+_.count);c<u;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(n=to(this,i,e,za,v,g,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(c/3),t.push(n));else if(void 0!==v)if(Array.isArray(i))for(c=0,u=w.length;c<u;c++)for(f=i[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)(n=to(this,f,e,za,v,g,y,x,b,o=h,s=h+1,l=h+2))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(v.count,_.start+_.count);c<u;c+=3)(n=to(this,i,e,za,v,g,y,x,b,o=c,s=c+1,l=c+2))&&(n.faceIndex=Math.floor(c/3),t.push(n))}else if(r.isGeometry){var M,S,E,T,A=Array.isArray(i),P=r.vertices,L=r.faces,R=r.faceVertexUvs[0];R.length>0&&(T=R);for(var C=0,I=L.length;C<I;C++){var D=L[C],O=A?i[D.materialIndex]:i;if(void 0!==O&&(M=P[D.a],S=P[D.b],E=P[D.c],n=eo(this,O,e,za,M,S,E,$a))){if(T&&T[C]){var N=T[C];Ya.copy(N[0]),Ja.copy(N[1]),Za.copy(N[2]),n.uv=ra.getUV($a,M,S,E,Ya,Ja,Za,new Dr)}n.face=D,n.faceIndex=C,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var no=0,ro=new Qr,io=new vi,ao=new Vr;function oo(){Object.defineProperty(this,"id",{value:no+=2}),this.uuid=Ir.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}oo.prototype=Object.assign(Object.create(Pr.prototype),{constructor:oo,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Or).getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(e)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return ro.makeRotationX(e),this.applyMatrix4(ro),this},rotateY:function(e){return ro.makeRotationY(e),this.applyMatrix4(ro),this},rotateZ:function(e){return ro.makeRotationZ(e),this.applyMatrix4(ro),this},translate:function(e,t,n){return ro.makeTranslation(e,t,n),this.applyMatrix4(ro),this},scale:function(e,t,n){return ro.makeScale(e,t,n),this.applyMatrix4(ro),this},lookAt:function(e){return io.lookAt(e),io.updateMatrix(),this.applyMatrix4(io.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=r.position.array,a=void 0!==r.normal?r.normal.array:void 0,o=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,l=void 0!==r.uv2?r.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<i.length;c+=3)t.vertices.push((new Vr).fromArray(i,c)),void 0!==o&&t.colors.push((new sa).fromArray(o,c));function h(e,n,r,i){var c=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],h=new ua(e,n,r,void 0===a?[]:[(new Vr).fromArray(a,3*e),(new Vr).fromArray(a,3*n),(new Vr).fromArray(a,3*r)],c,i);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new Dr).fromArray(s,2*e),(new Dr).fromArray(s,2*n),(new Dr).fromArray(s,2*r)]),void 0!==l&&t.faceVertexUvs[1].push([(new Dr).fromArray(l,2*e),(new Dr).fromArray(l,2*n),(new Dr).fromArray(l,2*r)])}var u=e.groups;if(u.length>0)for(c=0;c<u.length;c++)for(var p=u[c],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==n?h(n[f],n[f+1],n[f+2],p.materialIndex):h(f,f+1,f+2,p.materialIndex);else if(void 0!==n)for(c=0;c<n.length;c+=3)h(n[c],n[c+1],n[c+2]);else for(c=0;c<i.length/3;c+=3)h(c,c+1,c+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ao).negate(),this.translate(ao.x,ao.y,ao.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new Qr;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new Vr,t=new Vr,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new Vr;if(e){var s,l,c,h=new Vr,u=new Vr;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],h.subVectors(c,l),u.subVectors(s,l),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){var p=(a=this.faces[r]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(n=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new oo;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)l=new Vr,c={a:new Vr,b:new Vr,c:new Vr},o.push(l),s.push(c)}var l,c,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],l=h.faceNormals[n],c=h.vertexNormals[n],l.copy(i.normal),c.a.copy(i.vertexNormals[0]),c.b.copy(i.vertexNormals[1]),c.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ci),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Oi),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new Or).getNormalMatrix(t));for(var u=0,p=o.length;u<p;u++){var d=o[u].clone();void 0!==t&&d.applyMatrix4(t),a.push(d)}for(u=0,p=h.length;u<p;u++)c.push(h[u].clone());for(u=0,p=l.length;u<p;u++){var f,m,v,g=l[u],y=g.vertexNormals,x=g.vertexColors;(f=new ua(g.a+i,g.b+i,g.c+i)).normal.copy(g.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==r&&m.applyMatrix3(r).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(b=0,w=x.length;b<w;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(u=0,p=e.faceVertexUvs.length;u<p;u++){var _=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],S=[],E=0,T=M.length;E<T;E++)S.push(M[E].clone());this.faceVertexUvs[u].push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,r,i,a,o,s,l={},c=[],h=[],u=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(l[t]=n,c.push(this.vertices[n]),h[n]=c.length-1):h[n]=h[l[t]];var p=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=h[i.a],i.b=h[i.b],i.c=h[i.c],a=[i.a,i.b,i.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new Vr(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(i=[]);for(n=0;n<t;n++){var s=e[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],h={},u=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,v),x=M(x,6,g),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][i];o.push(T(b[0]),T(b[1]),T(b[2]))}if(m&&o.push(S(d.normal)),v){var w=d.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(g&&o.push(E(d.color)),y){var _=d.vertexColors;o.push(E(_[0]),E(_[1]),E(_[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function S(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function E(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=c.length,c.push(e.getHex())),h[t]}function T(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=r,e.data.normals=s,c.length>0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new oo).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=h.length;r<i;r++){var u=h[r],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],r=0,i=f[t].vertices.length;r<i;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,i=f[t].normals.length;r<i;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],r=0,i=v[t].vertexNormals.length;r<i;r++){var y=v[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],r=0,i=v[t].faceNormals.length;r<i;r++)g.faceNormals.push(v[t].faceNormals[r].clone());this.morphNormals.push(g)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=e.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class so extends Na{constructor(e,t,n,r,i,a){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};const o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;const s=[],l=[],c=[],h=[];let u=0,p=0;function d(e,t,n,r,i,a,d,f,m,v,g){const y=a/m,x=d/v,b=a/2,w=d/2,_=f/2,M=m+1,S=v+1;let E=0,T=0;const A=new Vr;for(let o=0;o<S;o++){const a=o*x-w;for(let s=0;s<M;s++){const u=s*y-b;A[e]=u*r,A[t]=a*i,A[n]=_,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(s/m),h.push(1-o/v),E+=1}}for(let o=0;o<v;o++)for(let e=0;e<m;e++){const t=u+e+M*o,n=u+e+M*(o+1),r=u+(e+1)+M*(o+1),i=u+(e+1)+M*o;s.push(t,n,i),s.push(n,r,i),T+=6}o.addGroup(p,T,g),p+=T,u+=E}d("z","y","x",-1,-1,n,t,e,a,i,0),d("z","y","x",1,-1,n,t,-e,a,i,1),d("x","z","y",1,1,e,n,t,r,a,2),d("x","z","y",1,-1,e,n,-t,r,a,3),d("x","y","z",1,-1,e,t,n,r,i,4),d("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new Sa(l,3)),this.setAttribute("normal",new Sa(c,3)),this.setAttribute("uv",new Sa(h,2))}}function lo(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function co(e){for(var t={},n=0;n<e.length;n++){var r=lo(e[n]);for(var i in r)t[i]=r[i]}return t}var ho={clone:lo,merge:co};function uo(e){da.call(this),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.skinning=!1,this.morphTargets=!1,this.morphNormals=!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,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function po(){vi.call(this),this.type="Camera",this.matrixWorldInverse=new Qr,this.projectionMatrix=new Qr,this.projectionMatrixInverse=new Qr}function fo(e,t,n,r){po.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}uo.prototype=Object.create(da.prototype),uo.prototype.constructor=uo,uo.prototype.isShaderMaterial=!0,uo.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=lo(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},uo.prototype.toJSON=function(e){var t=da.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},po.prototype=Object.assign(Object.create(vi.prototype),{constructor:po,isCamera:!0,copy:function(e,t){return vi.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Vr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){vi.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){vi.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),fo.prototype=Object.assign(Object.create(po.prototype),{constructor:fo,isPerspectiveCamera:!0,copy:function(e,t){return po.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Ir.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Ir.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Ir.RAD2DEG*Math.atan(Math.tan(.5*Ir.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Ir.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=vi.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var mo=90;function vo(e,t,n){if(vi.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var r=new fo(mo,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Vr(1,0,0)),this.add(r);var i=new fo(mo,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Vr(-1,0,0)),this.add(i);var a=new fo(mo,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Vr(0,1,0)),this.add(a);var o=new fo(mo,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Vr(0,-1,0)),this.add(o);var s=new fo(mo,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Vr(0,0,1)),this.add(s);var l=new fo(mo,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Vr(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;var u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function go(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Br.call(this,e,e,t)}function yo(e,t,n,r,i,a,o,s,l,c,h,u){zr.call(this,null,a,o,s,l,c,r,i,h,u),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:tr,this.minFilter=void 0!==c?c:tr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}vo.prototype=Object.create(vi.prototype),vo.prototype.constructor=vo,go.prototype=Object.create(Br.prototype),go.prototype.constructor=go,go.prototype.isWebGLCubeRenderTarget=!0,go.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new gi,r={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},i=new uo({type:"CubemapFromEquirect",uniforms:lo(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;var a=new Ka(new so(5,5,5),i);return n.add(a),new vo(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},yo.prototype=Object.create(zr.prototype),yo.prototype.constructor=yo,yo.prototype.isDataTexture=!0;var xo=new Oi,bo=new Vr;function wo(e,t,n,r,i,a){this.planes=[void 0!==e?e:new qi,void 0!==t?t:new qi,void 0!==n?n:new qi,void 0!==r?r:new qi,void 0!==i?i:new qi,void 0!==a?a:new qi]}Object.assign(wo.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,h-s,f-u,y-m).normalize(),t[1].setComponents(o+r,h+s,f+u,y+m).normalize(),t[2].setComponents(o+i,h+l,f+p,y+v).normalize(),t[3].setComponents(o-i,h-l,f-p,y-v).normalize(),t[4].setComponents(o-a,h-c,f-d,y-g).normalize(),t[5].setComponents(o+a,h+c,f+d,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),xo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(xo)},intersectsSprite:function(e){return xo.center.set(0,0,0),xo.radius=.7071067811865476,xo.applyMatrix4(e.matrixWorld),this.intersectsSphere(xo)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(bo.x=r.normal.x>0?e.max.x:e.min.x,bo.y=r.normal.y>0?e.max.y:e.min.y,bo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(bo)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var _o={common:{diffuse:{value:new sa(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Or},uv2Transform:{value:new Or},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},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 Dr(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 sa(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new sa(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Or}},sprite:{diffuse:{value:new sa(15658734)},opacity:{value:1},center:{value:new Dr(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Or}}};function Mo(){var e=null,t=!1,n=null;function r(i,a){!1!==t&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function So(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){t.isInterleavedBufferAttribute&&(t=t.data);var a=r.get(t);void 0===a?r.set(t,function(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?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&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,i)):a.version<t.version&&(!function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,i),a.version=t.version)}}}function Eo(e,t,n,r){oo.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new To(e,t,n,r)),this.mergeVertices()}function To(e,t,n,r){Na.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(r)||1,h=l+1,u=c+1,p=e/l,d=t/c,f=[],m=[],v=[],g=[];for(a=0;a<u;a++){var y=a*d-s;for(i=0;i<h;i++){var x=i*p-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/l),g.push(1-a/c)}}for(a=0;a<c;a++)for(i=0;i<l;i++){var b=i+h*a,w=i+h*(a+1),_=i+1+h*(a+1),M=i+1+h*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new Sa(m,3)),this.setAttribute("normal",new Sa(v,3)),this.setAttribute("uv",new Sa(g,2))}Eo.prototype=Object.create(oo.prototype),Eo.prototype.constructor=Eo,To.prototype=Object.create(Na.prototype),To.prototype.constructor=To;var Ao={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 ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\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.specularRoughness );\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:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_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_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, 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 dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * 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}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_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 dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\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);\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_Specular_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 ) {\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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 return 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#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\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\t\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#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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 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\tgetPointDirectLightIrradiance( 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\tgetSpotDirectLightIrradiance( 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\tgetDirectionalDirectLightIrradiance( 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 += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\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\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\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 ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef 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 );\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",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#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#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#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#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#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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\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\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\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\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\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\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\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;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",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 )\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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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 <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\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\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 <worldpos_vertex>\n\t#include <clipping_planes_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 <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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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 <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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\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 <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 <lights_toon_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_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 + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\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 <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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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 <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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\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 REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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 <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 <lights_physical_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#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\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 <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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <packing>\n#include <uv_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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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 <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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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 <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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},Po={basic:{uniforms:co([_o.common,_o.specularmap,_o.envmap,_o.aomap,_o.lightmap,_o.fog]),vertexShader:Ao.meshbasic_vert,fragmentShader:Ao.meshbasic_frag},lambert:{uniforms:co([_o.common,_o.specularmap,_o.envmap,_o.aomap,_o.lightmap,_o.emissivemap,_o.fog,_o.lights,{emissive:{value:new sa(0)}}]),vertexShader:Ao.meshlambert_vert,fragmentShader:Ao.meshlambert_frag},phong:{uniforms:co([_o.common,_o.specularmap,_o.envmap,_o.aomap,_o.lightmap,_o.emissivemap,_o.bumpmap,_o.normalmap,_o.displacementmap,_o.fog,_o.lights,{emissive:{value:new sa(0)},specular:{value:new sa(1118481)},shininess:{value:30}}]),vertexShader:Ao.meshphong_vert,fragmentShader:Ao.meshphong_frag},standard:{uniforms:co([_o.common,_o.envmap,_o.aomap,_o.lightmap,_o.emissivemap,_o.bumpmap,_o.normalmap,_o.displacementmap,_o.roughnessmap,_o.metalnessmap,_o.fog,_o.lights,{emissive:{value:new sa(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ao.meshphysical_vert,fragmentShader:Ao.meshphysical_frag},toon:{uniforms:co([_o.common,_o.specularmap,_o.aomap,_o.lightmap,_o.emissivemap,_o.bumpmap,_o.normalmap,_o.displacementmap,_o.gradientmap,_o.fog,_o.lights,{emissive:{value:new sa(0)},specular:{value:new sa(1118481)},shininess:{value:30}}]),vertexShader:Ao.meshtoon_vert,fragmentShader:Ao.meshtoon_frag},matcap:{uniforms:co([_o.common,_o.bumpmap,_o.normalmap,_o.displacementmap,_o.fog,{matcap:{value:null}}]),vertexShader:Ao.meshmatcap_vert,fragmentShader:Ao.meshmatcap_frag},points:{uniforms:co([_o.points,_o.fog]),vertexShader:Ao.points_vert,fragmentShader:Ao.points_frag},dashed:{uniforms:co([_o.common,_o.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ao.linedashed_vert,fragmentShader:Ao.linedashed_frag},depth:{uniforms:co([_o.common,_o.displacementmap]),vertexShader:Ao.depth_vert,fragmentShader:Ao.depth_frag},normal:{uniforms:co([_o.common,_o.bumpmap,_o.normalmap,_o.displacementmap,{opacity:{value:1}}]),vertexShader:Ao.normal_vert,fragmentShader:Ao.normal_frag},sprite:{uniforms:co([_o.sprite,_o.fog]),vertexShader:Ao.sprite_vert,fragmentShader:Ao.sprite_frag},background:{uniforms:{uvTransform:{value:new Or},t2D:{value:null}},vertexShader:Ao.background_vert,fragmentShader:Ao.background_frag},cube:{uniforms:co([_o.envmap,{opacity:{value:1}}]),vertexShader:Ao.cube_vert,fragmentShader:Ao.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ao.equirect_vert,fragmentShader:Ao.equirect_frag},distanceRGBA:{uniforms:co([_o.common,_o.displacementmap,{referencePosition:{value:new Vr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ao.distanceRGBA_vert,fragmentShader:Ao.distanceRGBA_frag},shadow:{uniforms:co([_o.lights,_o.fog,{color:{value:new sa(0)},opacity:{value:1}}]),vertexShader:Ao.shadow_vert,fragmentShader:Ao.shadow_frag}};function Lo(e,t,n,r){var i,a,o=new sa(0),s=0,l=null,c=0,h=null;function u(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),u(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(o,s=e)},render:function(t,r,p,d){var f=r.background,m=e.xr,v=m.getSession&&m.getSession();if(v&&"additive"===v.environmentBlendMode&&(f=null),null===f?u(o,s):f&&f.isColor&&(u(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||f.mapping===$n)){void 0===a&&((a=new Ka(new so(1,1,1),new uo({type:"BackgroundCubeMaterial",uniforms:lo(Po.cube.uniforms),vertexShader:Po.cube.vertexShader,fragmentShader:Po.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var g=f.isWebGLCubeRenderTarget?f.texture:f;a.material.uniforms.envMap.value=g,a.material.uniforms.flipEnvMap.value=g.isCubeTexture?-1:1,l===f&&c===g.version&&h===e.toneMapping||(a.material.needsUpdate=!0,l=f,c=g.version,h=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else f&&f.isTexture&&(void 0===i&&((i=new Ka(new To(2,2),new uo({type:"BackgroundMaterial",uniforms:lo(Po.background.uniforms),vertexShader:Po.background.vertexShader,fragmentShader:Po.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(i)),i.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),i.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&h===e.toneMapping||(i.material.needsUpdate=!0,l=f,c=f.version,h=e.toneMapping),t.unshift(i,i.geometry,i.material,0,0,null))}}}function Ro(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i)},this.renderInstances=function(r,o,s,l){if(0!==l){var c,h;if(a)c=e,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,o,s,l),n.update(s,i,l)}}}function Co(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=h>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function Io(){var e=this,t=null,n=0,r=!1,i=!1,a=new qi,o=new Or,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,r,i){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==i||null===c){var h=r+4*l,u=n.matrixWorldInverse;o.getNormalMatrix(u),(null===c||c.length<h)&&(c=new Float32Array(h));for(var p=0,d=r;p!==l;++p,d+=4)a.copy(t[p]).applyMatrix4(u,o),a.normal.toArray(c,d),c[d+3]=a.constant}s.value=c,s.needsUpdate=!0}return e.numPlanes=l,e.numIntersection=0,c}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=0!==e.length||i||0!==n||r;return r=i,t=c(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,c(null)},this.endShadows=function(){i=!1,l()},this.setState=function(e,a,o,h,u,p){if(!r||null===e||0===e.length||i&&!o)i?c(null):l();else{var d=i?0:n,f=4*d,m=u.clippingState||null;s.value=m,m=c(e,h,f,p);for(var v=0;v!==f;++v)m[v]=t[v];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function Do(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function Oo(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);o.removeEventListener("dispose",a),r.delete(o);var c=i.get(s);c&&(t.remove(c),i.delete(s)),n.memory.geometries--}function o(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,c=s.length;l<c;l+=3){var h=s[l+0],u=s[l+1],p=s[l+2];n.push(h,u,u,p,p,h)}}else{s=a.array;o=a.version;for(l=0,c=s.length/3-1;l<c;l+=3){h=l+0,u=l+1,p=l+2;n.push(h,u,u,p,p,h)}}var d=new(Aa(n)>65535?Ma:wa)(n,1);d.version=o,t.update(d,34963);var f=i.get(e);f&&t.remove(f),i.set(e,d)}return{get:function(e,t){var i=r.get(t);return i||(t.addEventListener("dispose",a),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Na).setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)},update:function(e){var n=e.index,r=e.attributes;for(var i in null!==n&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=i.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return i.get(e)}}}function No(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i)},this.renderInstances=function(r,l,c,h){if(0!==h){var u,p;if(s)u=e,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](i,c,a,l*o,h),n.update(c,i,h)}}}function Fo(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(r=r||1,t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function zo(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Uo(e){var t={},n=new Float32Array(8);return{update:function(r,i,a,o){var s=r.morphTargetInfluences,l=void 0===s?0:s.length,c=t[i.id];if(void 0===c){c=[];for(var h=0;h<l;h++)c[h]=[h,0];t[i.id]=c}var u=a.morphTargets&&i.morphAttributes.position,p=a.morphNormals&&i.morphAttributes.normal;for(h=0;h<l;h++){0!==(f=c[h])[1]&&(u&&i.deleteAttribute("morphTarget"+h),p&&i.deleteAttribute("morphNormal"+h))}for(h=0;h<l;h++){(f=c[h])[0]=h,f[1]=s[h]}c.sort(zo);var d=0;for(h=0;h<8;h++){var f;if(f=c[h]){var m=f[0],v=f[1];if(v){u&&i.setAttribute("morphTarget"+h,u[m]),p&&i.setAttribute("morphNormal"+h,p[m]),n[h]=v,d+=v;continue}}n[h]=0}var g=i.morphTargetsRelative?1:1-d;o.getUniforms().setValue(e,"morphTargetBaseInfluence",g),o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Bo(e,t,n,r){var i=new WeakMap;return{update:function(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){i=new WeakMap}}}function ko(e,t,n,r,i,a,o,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,o=void 0!==o?o:pr,zr.call(this,e,t,n,r,i,a,o,s,l,c),this.flipY=!1}function Go(e,t,n,r){zr.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=tr,this.minFilter=tr,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ho(e,t,n,r){zr.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=tr,this.minFilter=tr,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Po.physical={uniforms:co([Po.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Dr(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new sa(0)},transparency:{value:0}}]),vertexShader:Ao.meshphysical_vert,fragmentShader:Ao.meshphysical_frag},ko.prototype=Object.create(zr.prototype),ko.prototype.constructor=ko,ko.prototype.isCubeTexture=!0,Object.defineProperty(ko.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Go.prototype=Object.create(zr.prototype),Go.prototype.constructor=Go,Go.prototype.isDataTexture2DArray=!0,Ho.prototype=Object.create(zr.prototype),Ho.prototype.constructor=Ho,Ho.prototype.isDataTexture3D=!0;var jo=new zr,Vo=new Go,Wo=new Ho,qo=new ko,Xo=[],Yo=[],Jo=new Float32Array(16),Zo=new Float32Array(9),$o=new Float32Array(4);function Qo(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=Xo[i];if(void 0===a&&(a=new Float32Array(i),Xo[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function Ko(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function es(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function ts(e,t){var n=Yo[t];void 0===n&&(n=new Int32Array(t),Yo[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function ns(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function rs(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ko(n,t))return;e.uniform2fv(this.addr,t),es(n,t)}}function is(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Ko(n,t))return;e.uniform3fv(this.addr,t),es(n,t)}}function as(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ko(n,t))return;e.uniform4fv(this.addr,t),es(n,t)}}function os(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ko(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),es(n,t)}else{if(Ko(n,r))return;$o.set(r),e.uniformMatrix2fv(this.addr,!1,$o),es(n,r)}}function ss(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ko(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),es(n,t)}else{if(Ko(n,r))return;Zo.set(r),e.uniformMatrix3fv(this.addr,!1,Zo),es(n,r)}}function ls(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ko(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),es(n,t)}else{if(Ko(n,r))return;Jo.set(r),e.uniformMatrix4fv(this.addr,!1,Jo),es(n,r)}}function cs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||jo,i)}function hs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Vo,i)}function us(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Wo,i)}function ps(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||qo,i)}function ds(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function fs(e,t){var n=this.cache;Ko(n,t)||(e.uniform2iv(this.addr,t),es(n,t))}function ms(e,t){var n=this.cache;Ko(n,t)||(e.uniform3iv(this.addr,t),es(n,t))}function vs(e,t){var n=this.cache;Ko(n,t)||(e.uniform4iv(this.addr,t),es(n,t))}function gs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function ys(e,t){e.uniform1fv(this.addr,t)}function xs(e,t){e.uniform1iv(this.addr,t)}function bs(e,t){e.uniform2iv(this.addr,t)}function ws(e,t){e.uniform3iv(this.addr,t)}function _s(e,t){e.uniform4iv(this.addr,t)}function Ms(e,t){var n=Qo(t,this.size,2);e.uniform2fv(this.addr,n)}function Ss(e,t){var n=Qo(t,this.size,3);e.uniform3fv(this.addr,n)}function Es(e,t){var n=Qo(t,this.size,4);e.uniform4fv(this.addr,n)}function Ts(e,t){var n=Qo(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function As(e,t){var n=Qo(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ps(e,t){var n=Qo(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ls(e,t,n){var r=t.length,i=ts(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||jo,i[a])}function Rs(e,t,n){var r=t.length,i=ts(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||qo,i[a])}function Cs(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return ns;case 35664:return rs;case 35665:return is;case 35666:return as;case 35674:return os;case 35675:return ss;case 35676:return ls;case 5124:case 35670:return ds;case 35667:case 35671:return fs;case 35668:case 35672:return ms;case 35669:case 35673:return vs;case 5125:return gs;case 35678:case 36198:case 36298:case 36306:case 35682:return cs;case 35679:case 36299:case 36307:return us;case 35680:case 36300:case 36308:case 36293:return ps;case 36289:case 36303:case 36311:case 36292:return hs}}(t.type)}function Is(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ys;case 35664:return Ms;case 35665:return Ss;case 35666:return Es;case 35674:return Ts;case 35675:return As;case 35676:return Ps;case 5124:case 35670:return xs;case 35667:case 35671:return bs;case 35668:case 35672:return ws;case 35669:case 35673:return _s;case 35678:case 36198:case 36298:case 36306:case 35682:return Ls;case 35680:case 36300:case 36308:case 36293:return Rs}}(t.type)}function Ds(e){this.id=e,this.seq=[],this.map={}}Is.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),es(t,e)},Ds.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Os=/([\w\d_]+)(\])?(\[|\.)?/g;function Ns(e,t){e.seq.push(t),e.map[t.id]=t}function Fs(e,t,n){var r=e.name,i=r.length;for(Os.lastIndex=0;;){var a=Os.exec(r),o=Os.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===i){Ns(n,void 0===c?new Cs(s,e,t):new Is(s,e,t));break}var h=n.map[s];void 0===h&&Ns(n,h=new Ds(s)),n=h}}function zs(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Fs(i,e.getUniformLocation(t,i.name),this)}}function Us(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}zs.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},zs.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},zs.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},zs.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Bs=0;function ks(e){switch(e){case Mr:return["Linear","( value )"];case Sr: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:throw new Error("unsupported encoding: "+e)}}function Gs(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Hs(e,t){var n=ks(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function js(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Uncharted2";break;case 4:n="OptimizedCineon";break;case 5:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Vs(e){return""!==e}function Ws(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function qs(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Xs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ys(e){return e.replace(Xs,Js)}function Js(e,t){var n=Ao[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Ys(n)}var Zs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,$s=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function Qs(e){return e.replace($s,el).replace(Zs,Ks)}function Ks(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),el(e,t,n,r)}function el(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function tl(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function nl(e,t,n){var r,i,a,o,s,l=e.getContext(),c=n.defines,h=n.vertexShader,u=n.fragmentShader,p=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),d=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case $n:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}(n),f=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}(n),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),v=e.gammaFactor>0?e.gammaFactor:1,g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Vs).join("\n")}(n),y=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),x=l.createProgram();if(n.isRawShaderMaterial?((r=[y].filter(Vs).join("\n")).length>0&&(r+="\n"),(i=[g,y].filter(Vs).join("\n")).length>0&&(i+="\n")):(r=[tl(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+v,"#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 "+f:"",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.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",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 "+p:"",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"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef 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(Vs).join("\n"),i=[g,tl(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+v,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 "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",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.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",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 "+p:"",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?Ao.tonemapping_pars_fragment:"",0!==n.toneMapping?js("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Ao.encodings_pars_fragment:"",n.mapEncoding?Hs("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Hs("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Hs("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Hs("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Hs("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(a="linearToOutputTexel",o=n.outputEncoding,s=ks(o),"vec4 "+a+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Vs).join("\n")),h=qs(h=Ws(h=Ys(h),n),n),u=qs(u=Ws(u=Ys(u),n),n),h=Qs(h),u=Qs(u),n.isWebGL2&&!n.isRawShaderMaterial){var b=!1,w=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(w)&&null!==u.match(w)&&(b=!0,h=h.replace(w,""),u=u.replace(w,"")),r=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,i=["#version 300 es\n","#define varying in",b?"":"out highp vec4 pc_fragColor;",b?"":"#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"+i}var _,M,S=i+u,E=Us(l,35633,r+h),T=Us(l,35632,S);if(l.attachShader(x,E),l.attachShader(x,T),void 0!==n.index0AttributeName?l.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(x,0,"position"),l.linkProgram(x),e.debug.checkShaderErrors){var A=l.getProgramInfoLog(x).trim(),P=l.getShaderInfoLog(E).trim(),L=l.getShaderInfoLog(T).trim(),R=!0,C=!0;if(!1===l.getProgramParameter(x,35714)){R=!1;var I=Gs(l,E,"vertex"),D=Gs(l,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(x,35715),"gl.getProgramInfoLog",A,I,D)}else""!==A?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",A):""!==P&&""!==L||(C=!1);C&&(this.diagnostics={runnable:R,programLog:A,vertexShader:{log:P,prefix:r},fragmentShader:{log:L,prefix:i}})}return l.deleteShader(E),l.deleteShader(T),this.getUniforms=function(){return void 0===_&&(_=new zs(l,x)),_},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(l,x)),M},this.destroy=function(){l.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=Bs++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=E,this.fragmentShader=T,this}function rl(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,l=n.maxVertexUniforms,c=n.vertexTextures,h={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"},u=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function p(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=Mr,t}this.getParameters=function(r,u,d,f,m,v,g){var y=f.fog,x=r.isMeshStandardMaterial?f.environment:null,b=r.envMap||x,w=h[r.type],_=g.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var n=l,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(g):0;null!==r.precision&&(s=n.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",s,"instead.");var M=function(e,t){var n;if(t){var r=Po[t];n={name:e.type,uniforms:ho.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(r,w);r.onBeforeCompile(M,e);var S=e.getRenderTarget();return{isWebGL2:i,shaderID:w,shaderName:M.name,uniforms:M.uniforms,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:!0===g.isInstancedMesh,supportsVertexTextures:c,outputEncoding:null!==S?p(S.texture):e.outputEncoding,map:!!r.map,mapEncoding:p(r.map),matcap:!!r.matcap,matcapEncoding:p(r.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:p(b),envMapCubeUV:!!b&&(b.mapping===$n||307===b.mapping),lightMap:!!r.lightMap,lightMapEncoding:p(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:p(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||!r.displacementMap),fog:!!y,useFog:r.fog,fogExp2:y&&y.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&_>0,maxBones:_,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:v,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:i||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:i||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(void 0===t.isRawShaderMaterial){for(var i=0;i<u.length;i++)n.push(t[u[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new nl(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function il(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function al(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ol(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function sl(){var e=[],t=0,n=[],r=[],i={id:-1};function a(n,r,a,o,s,l){var c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=a,c.program=a.program||i,c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transparent:r,init:function(){t=0,n.length=0,r.length=0},push:function(e,t,i,o,s,l){var c=a(e,t,i,o,s,l);(!0===i.transparent?r:n).push(c)},unshift:function(e,t,i,o,s,l){var c=a(e,t,i,o,s,l);(!0===i.transparent?r:n).unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];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(e,t){n.length>1&&n.sort(e||al),r.length>1&&r.sort(t||ol)}}}function ll(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener("dispose",t),e.delete(r)}return{get:function(n,r){var i,a=e.get(n);return void 0===a?(i=new sl,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):void 0===(i=a.get(r))&&(i=new sl,a.set(r,i)),i},dispose:function(){e=new WeakMap}}}function cl(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Vr,color:new sa};break;case"SpotLight":n={position:new Vr,direction:new Vr,color:new sa,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Vr,color:new sa,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Vr,skyColor:new sa,groundColor:new sa};break;case"RectAreaLight":n={color:new sa,position:new Vr,halfWidth:new Vr,halfHeight:new Vr}}return e[t.id]=n,n}}}var hl=0;function ul(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function pl(){for(var e,t=new cl,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new Dr};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new Dr,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.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:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=0;i<9;i++)r.probe.push(new Vr);var a=new Vr,o=new Qr,s=new Qr;return{setup:function(e,i,l){for(var c=0,h=0,u=0,p=0;p<9;p++)r.probe[p].set(0,0,0);var d=0,f=0,m=0,v=0,g=0,y=0,x=0,b=0,w=l.matrixWorldInverse;e.sort(ul),p=0;for(var _=e.length;p<_;p++){var M=e[p],S=M.color,E=M.intensity,T=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)c+=S.r*E,h+=S.g*E,u+=S.b*E;else if(M.isLightProbe)for(var P=0;P<9;P++)r.probe[P].addScaledVector(M.sh.coefficients[P],E);else if(M.isDirectionalLight){if((C=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),M.castShadow){var L=M.shadow;(R=n.get(M)).shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,r.directionalShadow[d]=R,r.directionalShadowMap[d]=A,r.directionalShadowMatrix[d]=M.shadow.matrix,y++}r.directional[d]=C,d++}else if(M.isSpotLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(S).multiplyScalar(E),C.distance=T,C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow){L=M.shadow;(R=n.get(M)).shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,r.spotShadow[m]=R,r.spotShadowMap[m]=A,r.spotShadowMatrix[m]=M.shadow.matrix,b++}r.spot[m]=C,m++}else if(M.isRectAreaLight){(C=t.get(M)).color.copy(S).multiplyScalar(E),C.position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),s.identity(),o.copy(M.matrixWorld),o.premultiply(w),s.extractRotation(o),C.halfWidth.set(.5*M.width,0,0),C.halfHeight.set(0,.5*M.height,0),C.halfWidth.applyMatrix4(s),C.halfHeight.applyMatrix4(s),r.rectArea[v]=C,v++}else if(M.isPointLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(M.color).multiplyScalar(M.intensity),C.distance=M.distance,C.decay=M.decay,M.castShadow){var R;L=M.shadow;(R=n.get(M)).shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,R.shadowCameraNear=L.camera.near,R.shadowCameraFar=L.camera.far,r.pointShadow[f]=R,r.pointShadowMap[f]=A,r.pointShadowMatrix[f]=M.shadow.matrix,x++}r.point[f]=C,f++}else if(M.isHemisphereLight){var C;(C=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),C.direction.transformDirection(w),C.direction.normalize(),C.skyColor.copy(M.color).multiplyScalar(E),C.groundColor.copy(M.groundColor).multiplyScalar(E),r.hemi[g]=C,g++}}r.ambient[0]=c,r.ambient[1]=h,r.ambient[2]=u;var I=r.hash;I.directionalLength===d&&I.pointLength===f&&I.spotLength===m&&I.rectAreaLength===v&&I.hemiLength===g&&I.numDirectionalShadows===y&&I.numPointShadows===x&&I.numSpotShadows===b||(r.directional.length=d,r.spot.length=m,r.rectArea.length=v,r.point.length=f,r.hemi.length=g,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=x,r.pointShadowMap.length=x,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=x,r.spotShadowMatrix.length=b,I.directionalLength=d,I.pointLength=f,I.spotLength=m,I.rectAreaLength=v,I.hemiLength=g,I.numDirectionalShadows=y,I.numPointShadows=x,I.numSpotShadows=b,r.version=hl++)},state:r}}function dl(){var e=new pl,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(r){e.setup(t,n,r)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function fl(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener("dispose",t),e.delete(r)}return{get:function(n,r){var i;return!1===e.has(n)?(i=new dl,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):!1===e.get(n).has(r)?(i=new dl,e.get(n).set(r,i)):i=e.get(n).get(r),i},dispose:function(){e=new WeakMap}}}function ml(e){da.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,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(e)}function vl(e){da.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Vr,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}ml.prototype=Object.create(da.prototype),ml.prototype.constructor=ml,ml.prototype.isMeshDepthMaterial=!0,ml.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},vl.prototype=Object.create(da.prototype),vl.prototype.constructor=vl,vl.prototype.isMeshDistanceMaterial=!0,vl.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function gl(e,t,n){var r=new wo,i=new Dr,a=new Dr,o=new Ur,s=[],l=[],c={},h={0:1,1:0,2:2},u=new uo({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Dr},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONAL_PASS=1;var d=new Na;d.setAttribute("position",new va(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new Ka(d,u),m=this;function v(n,r){var i=t.update(f);u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,u,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,p,f,null)}function g(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return void 0===i&&(i=new ml({depthPacking:3201,morphTargets:e,skinning:t}),s[r]=i),i}function y(e,t,n){var r=e<<0|t<<1|n<<2,i=l[r];return void 0===i&&(i=new vl({morphTargets:e,skinning:t}),l[r]=i),i}function x(t,n,r,i,a,o,s){var l=null,u=g,p=t.customDepthMaterial;if(!0===i.isPointLight&&(u=y,p=t.customDistanceMaterial),void 0===p){var d=!1;!0===r.morphTargets&&(d=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(d,f,!0===t.isInstancedMesh)}else l=p;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var m=l.uuid,v=r.uuid,x=c[m];void 0===x&&(x={},c[m]=x);var b=x[v];void 0===b&&(b=l.clone(),x[v]=b),l=b}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===s?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:h[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function b(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var h=l.groups,u=0,p=h.length;u<p;u++){var d=h[u],f=c[d.materialIndex];if(f&&f.visible){var m=x(n,l,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,d)}}else if(c.visible){m=x(n,l,c,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var v=n.children,g=0,y=v.length;g<y;g++)b(v[g],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var d=0,f=t.length;d<f;d++){var g=t[d],y=g.shadow;if(void 0!==y){i.copy(y.mapSize);var x=y.getFrameExtents();if(i.multiply(x),a.copy(y.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/x.x),i.x=a.x*x.x,y.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/x.y),i.y=a.y*x.y,y.mapSize.y=a.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var w={minFilter:ir,magFilter:ir,format:dr};y.map=new Br(i.x,i.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new Br(i.x,i.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){w={minFilter:tr,magFilter:tr,format:dr};y.map=new Br(i.x,i.y,w),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),p.viewport(o),y.updateMatrices(g,M),r=y.getFrustum(),b(s,l,y.camera,g,this.type)}y.isPointLightShadow||3!==this.type||v(y,l)}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,h,u)}}}function yl(e,t,n){var r=n.isWebGL2;var i=new function(){var t=!1,n=new Ur,r=null,i=new Ur(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?U(2929):B(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},o=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?U(2960):B(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&l===r||(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null}}},s=e.getParameter(34921),l=new Uint8Array(s),c=new Uint8Array(s),h=new Uint8Array(s),u={},p=null,d=null,f=null,m=null,v=null,g=null,y=null,x=null,b=null,w=!1,_=null,M=null,S=null,E=null,T=null,A=e.getParameter(35661),P=!1,L=0,R=e.getParameter(7938);-1!==R.indexOf("WebGL")?(L=parseFloat(/^WebGL\ ([0-9])/.exec(R)[1]),P=L>=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(R)[1]),P=L>=2);var C=null,I={},D=new Ur,O=new Ur;function N(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var F={};function z(n,i){(l[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),h[n]!==i)&&((r?e:t.get("ANGLE_instanced_arrays"))[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),h[n]=i)}function U(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function B(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}F[3553]=N(3553,3553,1),F[34067]=N(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),o.setClear(0),U(2929),a.setFunc(3),V(!1),W(1),U(2884),j(0);var k={[Zn]:32774,101:32778,102:32779};if(r)k[103]=32775,k[104]=32776;else{var G=t.get("EXT_blend_minmax");null!==G&&(k[103]=G.MIN_EXT,k[104]=G.MAX_EXT)}var H={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function j(t,n,r,i,a,o,s,l){if(0!==t){if(d||(U(3042),d=!0),5===t)a=a||n,o=o||r,s=s||i,n===m&&a===y||(e.blendEquationSeparate(k[n],k[a]),m=n,y=a),r===v&&i===g&&o===x&&s===b||(e.blendFuncSeparate(H[r],H[i],H[o],H[s]),v=r,g=i,x=o,b=s),f=t,w=null;else if(t!==f||l!==w){if(m===Zn&&y===Zn||(e.blendEquation(32774),m=Zn,y=Zn),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}v=null,g=null,x=null,b=null,f=t,w=l}}else d&&(B(3042),d=!1)}function V(t){_!==t&&(t?e.frontFace(2304):e.frontFace(2305),_=t)}function W(t){0!==t?(U(2884),t!==M&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):B(2884),M=t}function q(t,n,r){t?(U(32823),E===n&&T===r||(e.polygonOffset(n,r),E=n,T=r)):B(32823)}function X(t){void 0===t&&(t=33984+A-1),C!==t&&(e.activeTexture(t),C=t)}return{buffers:{color:i,depth:a,stencil:o},initAttributes:function(){for(var e=0,t=l.length;e<t;e++)l[e]=0},enableAttribute:function(e){z(e,0)},enableAttributeAndDivisor:z,disableUnusedAttributes:function(){for(var t=0,n=c.length;t!==n;++t)c[t]!==l[t]&&(e.disableVertexAttribArray(t),c[t]=0)},vertexAttribPointer:function(t,n,i,a,o,s){!0!==r||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,a,o,s):e.vertexAttribIPointer(t,n,i,a,o,s)},enable:U,disable:B,useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:j,setMaterial:function(e,t){2===e.side?B(2884):U(2884);var n=1===e.side;t&&(n=!n),V(n),1===e.blending&&!1===e.transparent?j(0):j(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite);var r=e.stencilWrite;o.setTest(r),r&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==S&&(P&&e.lineWidth(t),S=t)},setPolygonOffset:q,setScissorTest:function(e){e?U(3089):B(3089)},activeTexture:X,bindTexture:function(t,n){null===C&&X();var r=I[C];void 0===r&&(r={type:void 0,texture:void 0},I[C]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=I[C];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===D.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),D.copy(t))},viewport:function(t){!1===O.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),O.copy(t))},reset:function(){for(var t=0;t<c.length;t++)1===c[t]&&(e.disableVertexAttribArray(t),c[t]=0);u={},C=null,I={},p=null,f=null,_=null,M=null,i.reset(),a.reset(),o.reset()}}}function xl(e,t,n,r,i,a,o){var s,l=i.isWebGL2,c=i.maxTextures,h=i.maxCubemapSize,u=i.maxTextureSize,p=i.maxSamples,d=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(B){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Ir.floorPowerOfTwo:Math.floor,o=a(i*e.width),l=a(i*e.height);void 0===s&&(s=m(o,l));var c=n?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return Ir.isPowerOfTwo(e.width)&&Ir.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==tr&&e.minFilter!==ir}function x(t,n,i,a){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function b(n,r,i){if(!1===l)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function w(e){return e===tr||e===nr||e===rr?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=r.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),r.remove(t)}(n),n.isVideoTexture&&d.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=r.get(t),i=r.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}(n),o.memory.textures--}var S=0;function E(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void I(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function T(t,i){if(6===t.image.length){var o=r.get(t);if(t.version>0&&o.__version!==t.version){C(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),c=t.image[0]&&t.image[0].isDataTexture,u=[],p=0;p<6;p++)u[p]=s||c?c?t.image[p].image:t.image[p]:v(t.image[p],!1,!0,h);var d,f=u[0],m=g(f)||l,w=a.convert(t.format),_=a.convert(t.type),M=b(t.internalFormat,w,_);if(R(34067,t,m),s){for(p=0;p<6;p++){d=u[p].mipmaps;for(var S=0;S<d.length;S++){var E=d[S];t.format!==dr&&t.format!==pr?null!==w?n.compressedTexImage2D(34069+p,S,M,E.width,E.height,0,E.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+p,S,M,E.width,E.height,0,w,_,E.data)}}o.__maxMipLevel=d.length-1}else{d=t.mipmaps;for(p=0;p<6;p++)if(c){n.texImage2D(34069+p,0,M,u[p].width,u[p].height,0,w,_,u[p].data);for(S=0;S<d.length;S++){var T=(E=d[S]).image[p].image;n.texImage2D(34069+p,S+1,M,T.width,T.height,0,w,_,T.data)}}else{n.texImage2D(34069+p,0,M,w,_,u[p]);for(S=0;S<d.length;S++){E=d[S];n.texImage2D(34069+p,S+1,M,w,_,E.image[p])}}o.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function A(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var P={[Qn]:10497,[Kn]:33071,[er]:33648},L={[tr]:9728,[nr]:9984,[rr]:9986,[ir]:9729,1007:9985,[ar]:9987};function R(n,a,o){o?(e.texParameteri(n,10242,P[a.wrapS]),e.texParameteri(n,10243,P[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[a.wrapR]),e.texParameteri(n,10240,L[a.magFilter]),e.texParameteri(n,10241,L[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===Kn&&a.wrapT===Kn||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(a.magFilter)),e.texParameteri(n,10241,w(a.minFilter)),a.minFilter!==tr&&a.minFilter!==ir&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(a.type===cr&&null===t.get("OES_texture_float_linear"))return;if(a.type===hr&&null===(l||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function C(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),o.memory.textures++)}function I(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var s=function(e){return!l&&(e.wrapS!==Kn||e.wrapT!==Kn||e.minFilter!==tr&&e.minFilter!==ir)}(r)&&!1===g(r.image),c=v(r.image,s,!1,u),h=g(c)||l,p=a.convert(r.format),d=a.convert(r.type),f=b(r.internalFormat,p,d);R(o,r,h);var m,w=r.mipmaps;if(r.isDepthTexture)f=6402,l?f=r.type===cr?36012:r.type===lr?33190:r.type===ur?35056:33189:r.type===cr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===fr&&6402===f&&r.type!==sr&&r.type!==lr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=sr,d=a.convert(r.type)),r.format===mr&&6402===f&&(f=34041,r.type!==ur&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ur,d=a.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,d,null);else if(r.isDataTexture)if(w.length>0&&h){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);r.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,c.width,c.height,0,p,d,c.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],r.format!==dr&&r.format!==pr?null!==p?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=w.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(w.length>0&&h){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,p,d,m);r.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,p,d,c),t.__maxMipLevel=0;y(r,h)&&x(o,r,c.width,c.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(t,i,o,s){var l=a.convert(i.texture.format),c=a.convert(i.texture.type),h=b(i.texture.internalFormat,l,c);n.texImage2D(s,0,h,i.width,i.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function O(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===cr?i=36012:o.type===lr&&(i=33190));var s=F(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){s=F(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var l=a.convert(n.texture.format),c=a.convert(n.texture.type);i=b(n.texture.internalFormat,l,c);if(r){s=F(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){var n=r.get(t),i=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),E(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===fr)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==mr)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),O(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),O(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function F(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var z=!1,U=!1;this.allocateTextureUnit=function(){var e=S;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=T,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(t){var i=r.get(t),s=r.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=g(t)||l;if(!l||t.texture.format!==pr||t.texture.type!==cr&&t.texture.type!==hr||(t.texture.format=dr,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){i.__webglFramebuffer=[];for(var p=0;p<6;p++)i.__webglFramebuffer[p]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),h)if(l){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var d=a.convert(t.texture.format),f=a.convert(t.texture.type),m=b(t.texture.internalFormat,d,f),v=F(t);e.renderbufferStorageMultisample(36161,v,m,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),O(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),R(34067,t.texture,u);for(p=0;p<6;p++)D(i.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,u)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),R(3553,t.texture,u),D(i.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||l)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),x(i,t,e.width,e.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),z=!0),e=e.texture),E(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),U=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?T(e,t):A(e,t)}}function bl(e,t,n){var r=n.isWebGL2;return{convert:function(e){var n;if(e===or)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(e===sr)return 5123;if(1013===e)return 5124;if(e===lr)return 5125;if(e===cr)return 5126;if(e===hr)return r?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(e===pr)return 6407;if(e===dr)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(e===fr)return 6402;if(e===mr)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===ur?r?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function wl(e){fo.call(this),this.cameras=e||[]}function _l(){vi.call(this),this.type="Group"}function Ml(){this._targetRay=null,this._grip=null}function Sl(e,t){var n=this,r=null,i=1,a=null,o="local-floor",s=null,l=[],c=new Map,h=new fo;h.layers.enable(1),h.viewport=new Ur;var u=new fo;u.layers.enable(2),u.viewport=new Ur;var p=[h,u],d=new wl;d.layers.enable(1),d.layers.enable(2);var f=null,m=null;function v(e){var t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function g(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){a=e,S.setContext(r),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function x(e){for(var t=r.inputSources,n=0;n<l.length;n++)c.set(t[n],l[n]);for(n=0;n<e.removed.length;n++){var i=e.removed[n];(a=c.get(i))&&(a.dispatchEvent({type:"disconnected",data:i}),c.delete(i))}for(n=0;n<e.added.length;n++){var a;i=e.added[n];(a=c.get(i))&&a.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=l[e];return void 0===t&&(t=new Ml,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=l[e];return void 0===t&&(t=new Ml,l[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(null!==(r=e)){r.addEventListener("select",v),r.addEventListener("selectstart",v),r.addEventListener("selectend",v),r.addEventListener("squeeze",v),r.addEventListener("squeezestart",v),r.addEventListener("squeezeend",v),r.addEventListener("end",g);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(y),r.addEventListener("inputsourceschange",x)}};var b=new Vr,w=new Vr;function _(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){d.near=u.near=h.near=e.near,d.far=u.far=h.far=e.far,f===d.near&&m===d.far||(r.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);var t=e.parent,n=d.cameras;_(d,t);for(var i=0;i<n.length;i++)_(n[i],t);e.matrixWorld.copy(d.matrixWorld);for(var a=e.children,o=(i=0,a.length);i<o;i++)a[i].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(w),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],h=(i[8]-1)/i[0],u=(a[8]+1)/a[0],p=o*h,d=o*u,f=r/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=p-m,x=d+(r-m),_=l*s/g*v,M=c*s/g*v;e.projectionMatrix.makePerspective(y,x,_,M,v,g)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};var M=null;var S=new Mo;S.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(a))){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var c=!1;i.length!==d.cameras.length&&(d.cameras.length=0,c=!0);for(var h=0;h<i.length;h++){var u=i[h],f=o.getViewport(u),m=p[h];m.matrix.fromArray(u.transform.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===h&&d.matrix.copy(m.matrix),!0===c&&d.cameras.push(m)}}var v=r.inputSources;for(h=0;h<l.length;h++){var g=l[h],y=v[h];g.update(y,n,a)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function El(e){function t(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i,a,o=n.envMap||r;o&&(t.envMap.value=o,t.flipEnvMap.value=o.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(o).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap&&(i=n.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),t.uv2Transform.value.copy(a.matrix))}function n(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){r.isMeshBasicMaterial?t(e,r):r.isMeshLambertMaterial?(t(e,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,r)):r.isMeshToonMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshPhongMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshStandardMaterial?(t(e,r,i),r.isMeshPhysicalMaterial?function(e,t,r){n(e,t,r),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,r,i):n(e,r,i)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Tl(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,p=null;this.domElement=t,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=Mr,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,f,m,v,g,y,x,b,w,_,M,S,E,T,A,P,L,R,C,I=this,D=!1,O=null,N=0,F=0,z=null,U=null,B=-1,k={geometry:null,program:null,wireframe:!1},G=null,H=null,j=new Ur,V=new Ur,W=null,q=t.width,X=t.height,Y=1,J=null,Z=null,$=new Ur(0,0,q,X),Q=new Ur(0,0,q,X),K=!1,ee=new wo,te=new Io,ne=!1,re=!1,ie=new Qr,ae=new Vr;function oe(){return null===z?Y:1}try{var se={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(t.addEventListener("webglcontextlost",ue,!1),t.addEventListener("webglcontextrestored",pe,!1),null===(d=n||t.getContext("webgl",se)||t.getContext("experimental-webgl",se)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Me){throw console.error("THREE.WebGLRenderer: "+Me.message),Me}function le(){f=new Do(d),!1===(m=new Co(d,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),C=new bl(d,f,m),(v=new yl(d,f,m)).scissor(V.copy(Q).multiplyScalar(Y).floor()),v.viewport(j.copy($).multiplyScalar(Y).floor()),g=new Fo(d),y=new il,x=new xl(d,f,v,y,m,C,g),b=new So(d,m),w=new Oo(d,b,g),_=new Bo(d,w,b,g),P=new Uo(d),M=new rl(I,f,m),S=new El(y),E=new ll,T=new fl,A=new Lo(I,v,_,s),L=new Ro(d,f,g,m),R=new No(d,f,g,m),g.programs=M.programs,I.capabilities=m,I.extensions=f,I.properties=y,I.renderLists=E,I.state=v,I.info=g}le();var ce=new Sl(I,d);this.xr=ce;var he=new gl(I,_,m.maxTextureSize);function ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function pe(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1,le()}function de(e){var t=e.target;t.removeEventListener("dispose",de),function(e){fe(e),y.remove(e)}(t)}function fe(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=he,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Dr),e.set(q,X)},this.setSize=function(e,n,r){ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=e,X=n,t.width=Math.floor(e*Y),t.height=Math.floor(n*Y),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Dr),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,n,r){q=e,X=n,Y=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Ur),e.copy(j)},this.getViewport=function(e){return e.copy($)},this.setViewport=function(e,t,n,r){e.isVector4?$.set(e.x,e.y,e.z,e.w):$.set(e,t,n,r),v.viewport(j.copy($).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,r){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,r),v.scissor(V.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return K},this.setScissorTest=function(e){v.setScissorTest(K=e)},this.setOpaqueSort=function(e){J=e},this.setTransparentSort=function(e){Z=e},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),d.clear(r)},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(){t.removeEventListener("webglcontextlost",ue,!1),t.removeEventListener("webglcontextrestored",pe,!1),E.dispose(),T.dispose(),y.dispose(),_.dispose(),ce.dispose(),ge.stop()},this.renderBufferImmediate=function(e,t){v.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=d.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=d.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=d.createBuffer()),e.hasColors&&!n.color&&(n.color=d.createBuffer());var r=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,n.position),d.bufferData(34962,e.positionArray,35048),v.enableAttribute(r.position),d.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,n.normal),d.bufferData(34962,e.normalArray,35048),v.enableAttribute(r.normal),d.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,n.uv),d.bufferData(34962,e.uvArray,35048),v.enableAttribute(r.uv),d.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,n.color),d.bufferData(34962,e.colorArray,35048),v.enableAttribute(r.color),d.vertexAttribPointer(r.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var me=new gi;this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=me);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=_e(e,t,r,i);v.setMaterial(r,o);var l=!1;k.geometry===n.id&&k.program===s.id&&k.wireframe===(!0===r.wireframe)||(k.geometry=n.id,k.program=s.id,k.wireframe=!0===r.wireframe,l=!0),(r.morphTargets||r.morphNormals)&&(P.update(i,n,r,s),l=!0),!0===i.isInstancedMesh&&(l=!0);var c=n.index,h=n.attributes.position;if(null===c){if(void 0===h||0===h.count)return}else if(0===c.count)return;var u,p=1;!0===r.wireframe&&(c=w.getWireframeAttribute(n),p=2);var g=L;null!==c&&(u=b.get(c),(g=R).setIndex(u)),l&&(!function(e,t,n,r){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;v.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var l=a[s];if(l>=0){var c=i[s];if(void 0!==c){var h=c.normalized,u=c.itemSize;if(void 0===(M=b.get(c)))continue;var p=M.buffer,g=M.type,y=M.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,w=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):v.enableAttribute(l),d.bindBuffer(34962,p),v.vertexAttribPointer(l,u,g,h,w*y,_*y)}else c.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=c.meshPerAttribute*c.count)):v.enableAttribute(l),d.bindBuffer(34962,p),v.vertexAttribPointer(l,u,g,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;p=M.buffer,g=M.type;v.enableAttributeAndDivisor(l+0,1),v.enableAttributeAndDivisor(l+1,1),v.enableAttributeAndDivisor(l+2,1),v.enableAttributeAndDivisor(l+3,1),d.bindBuffer(34962,p),d.vertexAttribPointer(l+0,4,g,!1,64,0),d.vertexAttribPointer(l+1,4,g,!1,64,16),d.vertexAttribPointer(l+2,4,g,!1,64,32),d.vertexAttribPointer(l+3,4,g,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:d.vertexAttrib2fv(l,S);break;case 3:d.vertexAttrib3fv(l,S);break;case 4:d.vertexAttrib4fv(l,S);break;default:d.vertexAttrib1fv(l,S)}}}}v.disableUnusedAttributes()}(i,n,r,s),null!==c&&d.bindBuffer(34963,u.buffer));var y=null!==c?c.count:h.count,x=n.drawRange.start*p,_=n.drawRange.count*p,M=null!==a?a.start*p:0,S=null!==a?a.count*p:1/0,E=Math.max(x,M),T=Math.min(y,x+_,M+S)-1,A=Math.max(0,T-E+1);if(0!==A){if(i.isMesh)!0===r.wireframe?(v.setLineWidth(r.wireframeLinewidth*oe()),g.setMode(1)):g.setMode(4);else if(i.isLine){var C=r.linewidth;void 0===C&&(C=1),v.setLineWidth(C*oe()),i.isLineSegments?g.setMode(1):i.isLineLoop?g.setMode(2):g.setMode(3)}else i.isPoints?g.setMode(0):i.isSprite&&g.setMode(4);if(i.isInstancedMesh)g.renderInstances(n,E,A,i.count);else if(n.isInstancedBufferGeometry){var I=Math.min(n.instanceCount,n._maxInstanceCount);g.renderInstances(n,E,A,I)}else g.render(E,A)}},this.compile=function(e,t){(p=T.get(e,t)).init(),e.traverse((function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))})),p.setupLights(t);const n={};e.traverse((function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n==!1&&(we(a,e,t),n[a.uuid]=!0)}else r.uuid in n==!1&&(we(r,e,t),n[r.uuid]=!0)}))};var ve=null;var ge=new Mo;function ye(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie);var i=_.update(e);(a=e.material).visible&&u.push(e,i,a,n,ae.z,null)}}else if(e.isImmediateRenderObject)r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie),u.push(e,null,e.material,n,ae.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==g.render.frame&&(e.skeleton.update(),e.skeleton.frame=g.render.frame),!e.frustumCulled||ee.intersectsObject(e))){r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie);i=_.update(e);var a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,l=o.length;s<l;s++){var c=o[s],h=a[c.materialIndex];h&&h.visible&&u.push(e,i,h,n,ae.z,c)}else a.visible&&u.push(e,i,a,n,ae.z,null)}var d=e.children;for(s=0,l=d.length;s<l;s++)ye(d[s],t,n,r)}}function xe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,c=void 0===r?o.material:r,h=o.group;if(n.isArrayCamera){H=n;for(var u=n.cameras,d=0,f=u.length;d<f;d++){var m=u[d];s.layers.test(m.layers)&&(v.viewport(j.copy(m.viewport)),p.setupLights(m),be(s,t,m,l,c,h))}}else H=null,be(s,t,n,l,c,h)}}function be(e,t,n,r,i,a){if(e.onBeforeRender(I,t,n,r,i,a),p=T.get(t,H||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=_e(n,t,i,e);v.setMaterial(i),k.geometry=null,k.program=null,k.wireframe=!1,function(e,t){e.render((function(e){I.renderBufferImmediate(e,t)}))}(e,o)}else I.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(I,t,n,r,i,a),p=T.get(t,H||n)}function we(e,t,n){var r=y.get(e),i=p.state.lights,a=p.state.shadowsArray,o=i.state.version,s=M.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),l=M.getProgramCacheKey(s),c=r.program,h=!0;if(void 0===c)e.addEventListener("dispose",de);else if(c.cacheKey!==l)fe(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(c=M.acquireProgram(s,l),r.program=c,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=c);var u=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<I.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(d=0;d<I.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}var f=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,f.clippingPlanes=te.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMap.value=i.state.directionalShadowMap,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotShadowMap.value=i.state.spotShadowMap,f.spotShadowMatrix.value=i.state.spotShadowMatrix,f.pointShadowMap.value=i.state.pointShadowMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix);var m=r.program.getUniforms(),v=zs.seqWithValue(m.seq,f);r.uniformsList=v}function _e(e,t,n,r){x.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===z?I.outputEncoding:z.texture.encoding,s=y.get(n),l=p.state.lights;if(ne&&(re||e!==G)){var c=e===G&&n.id===B;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,c)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==i||s.environment!==a||s.needsLights&&s.lightsStateVersion!==l.state.version?we(n,t,r):void 0===s.numClippingPlanes||s.numClippingPlanes===te.numPlanes&&s.numIntersection===te.numIntersection?s.outputEncoding!==o&&we(n,t,r):we(n,t,r):(we(n,t,r),s.__version=n.version);var h,u,f=!1,g=!1,b=!1,w=s.program,_=w.getUniforms(),M=s.uniforms;if(v.useProgram(w.program)&&(f=!0,g=!0,b=!0),n.id!==B&&(B=n.id,g=!0),f||G!==e){if(_.setValue(d,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&_.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),G!==e&&(G=e,g=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var E=_.map.cameraPosition;void 0!==E&&E.setValue(d,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&_.setValue(d,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){_.setOptional(d,r,"bindMatrix"),_.setOptional(d,r,"bindMatrixInverse");var T=r.skeleton;if(T){var A=T.bones;if(m.floatVertexTextures){if(void 0===T.boneTexture){var P=Math.sqrt(4*A.length);P=Ir.ceilPowerOfTwo(P),P=Math.max(P,4);var L=new Float32Array(P*P*4);L.set(T.boneMatrices);var R=new yo(L,P,P,dr,cr);T.boneMatrices=L,T.boneTexture=R,T.boneTextureSize=P}_.setValue(d,"boneTexture",T.boneTexture,x),_.setValue(d,"boneTextureSize",T.boneTextureSize)}else _.setOptional(d,T,"boneMatrices")}}return(g||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,_.setValue(d,"receiveShadow",r.receiveShadow)),g&&(_.setValue(d,"toneMappingExposure",I.toneMappingExposure),_.setValue(d,"toneMappingWhitePoint",I.toneMappingWhitePoint),s.needsLights&&(u=b,(h=M).ambientLightColor.needsUpdate=u,h.lightProbe.needsUpdate=u,h.directionalLights.needsUpdate=u,h.directionalLightShadows.needsUpdate=u,h.pointLights.needsUpdate=u,h.pointLightShadows.needsUpdate=u,h.spotLights.needsUpdate=u,h.spotLightShadows.needsUpdate=u,h.rectAreaLights.needsUpdate=u,h.hemisphereLights.needsUpdate=u),i&&n.fog&&S.refreshFogUniforms(M,i),S.refreshMaterialUniforms(M,n,a,Y,X),void 0!==M.ltc_1&&(M.ltc_1.value=_o.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=_o.LTC_2),zs.upload(d,s.uniformsList,M,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(zs.upload(d,s.uniformsList,M,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(d,"center",r.center),_.setValue(d,"modelViewMatrix",r.modelViewMatrix),_.setValue(d,"normalMatrix",r.normalMatrix),_.setValue(d,"modelMatrix",r.matrixWorld),w}ge.setAnimationLoop((function(e){ce.isPresenting||ve&&ve(e)})),"undefined"!=typeof window&&ge.setContext(window),this.setAnimationLoop=function(e){ve=e,ce.setAnimationLoop(e),ge.start()},this.render=function(e,t){var n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),t&&t.isCamera){if(!D){k.geometry=null,k.program=null,k.wireframe=!1,B=-1,G=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ce.enabled&&ce.isPresenting&&(t=ce.getCamera(t)),e.onBeforeRender(I,e,t,n||z),(p=T.get(e,t)).init(),ie.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(ie),re=this.localClippingEnabled,ne=te.init(this.clippingPlanes,re,t),(u=E.get(e,t)).init(),ye(e,t,0,I.sortObjects),u.finish(),!0===I.sortObjects&&u.sort(J,Z),ne&&te.beginShadows();var i=p.state.shadowsArray;he.render(i,e,t),p.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),A.render(u,e,t,r);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&xe(a,e,t,s),o.length&&xe(o,e,t,s)}else a.length&&xe(a,e,t),o.length&&xe(o,e,t);e.onAfterRender(I,e,t),null!==z&&(x.updateRenderTargetMipmap(z),x.updateMultisampleRenderTarget(z)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),u=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){O!==e&&null===z&&d.bindFramebuffer(36160,e),O=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return z},this.setRenderTarget=function(e,t,n){z=e,N=t,F=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var r=O,i=!1;if(e){var a=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:a,j.copy(e.viewport),V.copy(e.scissor),W=e.scissorTest}else j.copy($).multiplyScalar(Y).floor(),V.copy(Q).multiplyScalar(Y).floor(),W=K;if(U!==r&&(d.bindFramebuffer(36160,r),U=r),v.viewport(j),v.scissor(V),v.setScissorTest(W),i){var o=y.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==U&&(d.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,h=c.format,u=c.type;if(h!==dr&&C.convert(h)!==d.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===or||C.convert(u)===d.getParameter(35738)||u===cr&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||u===hr&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&d.readPixels(t,n,r,i,C.convert(h),C.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&d.bindFramebuffer(36160,U)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=C.convert(t.format);x.setTexture2D(t,0),d.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){void 0===r&&(r=0);var i=t.image.width,a=t.image.height,o=C.convert(n.format),s=C.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?d.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):d.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&d.generateMipmap(3553),v.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Al(e,t){this.name="",this.color=new sa(e),this.density=void 0!==t?t:25e-5}function Pl(e,t,n){this.name="",this.color=new sa(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Ll(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tr,this.updateRange={offset:0,count:-1},this.version=0}wl.prototype=Object.assign(Object.create(fo.prototype),{constructor:wl,isArrayCamera:!0}),_l.prototype=Object.assign(Object.create(vi.prototype),{constructor:_l,isGroup:!0}),Object.assign(Ml.prototype,{constructor:Ml,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new _l,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new _l,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(null!==a&&null!==(r=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&(a.visible=null!==r),null!==o&&(o.visible=null!==i),this}}),Object.assign(Sl.prototype,Pr.prototype),Object.assign(Al.prototype,{isFogExp2:!0,clone:function(){return new Al(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Pl.prototype,{isFog:!0,clone:function(){return new Pl(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Ll.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ll.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Rl,Cl=new Vr;function Il(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Dl(e){da.call(this),this.type="SpriteMaterial",this.color=new sa(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Il.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Il.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Cl.x=this.getX(t),Cl.y=this.getY(t),Cl.z=this.getZ(t),Cl.applyMatrix4(e),this.setXYZ(t,Cl.x,Cl.y,Cl.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new va(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Dl.prototype=Object.create(da.prototype),Dl.prototype.constructor=Dl,Dl.prototype.isSpriteMaterial=!0,Dl.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Ol=new Vr,Nl=new Vr,Fl=new Vr,zl=new Dr,Ul=new Dr,Bl=new Qr,kl=new Vr,Gl=new Vr,Hl=new Vr,jl=new Dr,Vl=new Dr,Wl=new Dr;function ql(e){if(vi.call(this),this.type="Sprite",void 0===Rl){Rl=new Na;var t=new Ll(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Rl.setIndex([0,1,2,0,2,3]),Rl.setAttribute("position",new Il(t,3,0,!1)),Rl.setAttribute("uv",new Il(t,2,3,!1))}this.geometry=Rl,this.material=void 0!==e?e:new Dl,this.center=new Dr(.5,.5)}function Xl(e,t,n,r,i,a){zl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Ul.x=a*zl.x-i*zl.y,Ul.y=i*zl.x+a*zl.y):Ul.copy(zl),e.copy(t),e.x+=Ul.x,e.y+=Ul.y,e.applyMatrix4(Bl)}ql.prototype=Object.assign(Object.create(vi.prototype),{constructor:ql,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Nl.setFromMatrixScale(this.matrixWorld),Bl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Fl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Nl.multiplyScalar(-Fl.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Xl(kl.set(-.5,-.5,0),Fl,a,Nl,n,r),Xl(Gl.set(.5,-.5,0),Fl,a,Nl,n,r),Xl(Hl.set(.5,.5,0),Fl,a,Nl,n,r),jl.set(0,0),Vl.set(1,0),Wl.set(1,1);var o=e.ray.intersectTriangle(kl,Gl,Hl,!1,Ol);if(null!==o||(Xl(Gl.set(-.5,.5,0),Fl,a,Nl,n,r),Vl.set(0,1),null!==(o=e.ray.intersectTriangle(kl,Hl,Gl,!1,Ol)))){var s=e.ray.origin.distanceTo(Ol);s<e.near||s>e.far||t.push({distance:s,point:Ol.clone(),uv:ra.getUV(Ol,kl,Gl,Hl,jl,Vl,Wl,new Dr),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return vi.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Yl,Jl,Zl,$l,Ql,Kl=new Vr,ec=new Vr;function tc(){vi.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function nc(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Ka.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Qr,this.bindMatrixInverse=new Qr}tc.prototype=Object.assign(Object.create(vi.prototype),{constructor:tc,isLOD:!0,copy:function(e){vi.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Kl.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Kl);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Kl.setFromMatrixPosition(e.matrixWorld),ec.setFromMatrixPosition(this.matrixWorld);var n=Kl.distanceTo(ec)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=vi.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),nc.prototype=Object.assign(Object.create(Ka.prototype),{constructor:nc,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Ur,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Ka.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(Yl=new Vr,Jl=new Ur,Zl=new Ur,$l=new Vr,Ql=new Qr,function(e,t){var n=this.skeleton,r=this.geometry;Jl.fromBufferAttribute(r.attributes.skinIndex,e),Zl.fromBufferAttribute(r.attributes.skinWeight,e),Yl.fromBufferAttribute(r.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=Zl.getComponent(i);if(0!==a){var o=Jl.getComponent(i);Ql.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector($l.copy(Yl).applyMatrix4(Ql),a)}}return t.applyMatrix4(this.bindMatrixInverse)})});var rc=new Qr,ic=new Qr;function ac(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Qr)}}function oc(){vi.call(this),this.type="Bone"}Object.assign(ac.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Qr;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:ic;rc.multiplyMatrices(o,t[i]),rc.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)},clone:function(){return new ac(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),oc.prototype=Object.assign(Object.create(vi.prototype),{constructor:oc,isBone:!0});var sc=new Qr,lc=new Qr,cc=[],hc=new Ka;function uc(e,t,n){Ka.call(this,e,t),this.instanceMatrix=new va(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function pc(e){da.call(this),this.type="LineBasicMaterial",this.color=new sa(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}uc.prototype=Object.assign(Object.create(Ka.prototype),{constructor:uc,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(hc.geometry=this.geometry,hc.material=this.material,void 0!==hc.material)for(var i=0;i<r;i++){this.getMatrixAt(i,sc),lc.multiplyMatrices(n,sc),hc.matrixWorld=lc,hc.raycast(e,cc);for(var a=0,o=cc.length;a<o;a++){var s=cc[a];s.instanceId=i,s.object=this,t.push(s)}cc.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),pc.prototype=Object.create(da.prototype),pc.prototype.constructor=pc,pc.prototype.isLineBasicMaterial=!0,pc.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var dc=new Vr,fc=new Vr,mc=new Qr,vc=new Hi,gc=new Oi;function yc(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),vi.call(this),this.type="Line",this.geometry=void 0!==e?e:new Na,this.material=void 0!==t?t:new pc,this.updateMorphTargets()}yc.prototype=Object.assign(Object.create(vi.prototype),{constructor:yc,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)dc.fromBufferAttribute(t,r-1),fc.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=dc.distanceTo(fc);e.setAttribute("lineDistance",new Sa(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),gc.copy(n.boundingSphere),gc.applyMatrix4(r),gc.radius+=i,!1!==e.ray.intersectsSphere(gc)){mc.getInverse(r),vc.copy(e.ray).applyMatrix4(mc);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Vr,l=new Vr,c=new Vr,h=new Vr,u=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length-1;m<v;m+=u){var g=f[m],y=f[m+1];if(s.fromArray(d,3*g),l.fromArray(d,3*y),!(vc.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=d.length/3-1;m<v;m+=u){if(s.fromArray(d,3*m),l.fromArray(d,3*m+3),!(vc.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;if(!(vc.distanceSqToSegment(x[m],x[m+1],h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var xc=new Vr,bc=new Vr;function wc(e,t){yc.call(this,e,t),this.type="LineSegments"}function _c(e,t){yc.call(this,e,t),this.type="LineLoop"}function Mc(e){da.call(this),this.type="PointsMaterial",this.color=new sa(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}wc.prototype=Object.assign(Object.create(yc.prototype),{constructor:wc,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)xc.fromBufferAttribute(t,r),bc.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+xc.distanceTo(bc);e.setAttribute("lineDistance",new Sa(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,r=0,i=a.length;r<i;r+=2)xc.copy(a[r]),bc.copy(a[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+xc.distanceTo(bc)}return this}}),_c.prototype=Object.assign(Object.create(yc.prototype),{constructor:_c,isLineLoop:!0}),Mc.prototype=Object.create(da.prototype),Mc.prototype.constructor=Mc,Mc.prototype.isPointsMaterial=!0,Mc.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Sc=new Qr,Ec=new Hi,Tc=new Oi,Ac=new Vr;function Pc(e,t){vi.call(this),this.type="Points",this.geometry=void 0!==e?e:new Na,this.material=void 0!==t?t:new Mc,this.updateMorphTargets()}function Lc(e,t,n,r,i,a,o){var s=Ec.distanceSqToPoint(e);if(s<n){var l=new Vr;Ec.closestPointToPoint(e,l),l.applyMatrix4(r);var c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function Rc(e,t,n,r,i,a,o,s,l){zr.call(this,e,t,n,r,i,a,o,s,l),this.format=void 0!==o?o:pr,this.minFilter=void 0!==a?a:ir,this.magFilter=void 0!==i?i:ir,this.generateMipmaps=!1}function Cc(e,t,n,r,i,a,o,s,l,c,h,u){zr.call(this,null,a,o,s,l,c,r,i,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ic(e,t,n,r,i,a,o,s,l){zr.call(this,e,t,n,r,i,a,o,s,l),this.needsUpdate=!0}function Dc(e,t,n,r,i,a,o,s,l,c){if((c=void 0!==c?c:fr)!==fr&&c!==mr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===fr&&(n=sr),void 0===n&&c===mr&&(n=ur),zr.call(this,null,r,i,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:tr,this.minFilter=void 0!==s?s:tr,this.flipY=!1,this.generateMipmaps=!1}function Oc(e){Na.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,l,c,h,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],l=v[f[(n+1)%3]],p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]})}for(c in d)o=d[c],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var g,y,x,b,w,_,M;if(h=new Vr,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(t=w=(b=x[i]).start,r=w+b.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]});for(c in d)o=d[c],h.fromBufferAttribute(g,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(g,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,r=(g=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)_=3*t+n,h.fromBufferAttribute(g,_),u.push(h.x,h.y,h.z),M=3*t+(n+1)%3,h.fromBufferAttribute(g,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new Sa(u,3))}function Nc(e,t,n){oo.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Fc(e,t,n)),this.mergeVertices()}function Fc(e,t,n){Na.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r,i,a=[],o=[],s=[],l=[],c=1e-5,h=new Vr,u=new Vr,p=new Vr,d=new Vr,f=new Vr;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(r=0;r<=n;r++){var v=r/n;for(i=0;i<=t;i++){var g=i/t;e(g,v,u),o.push(u.x,u.y,u.z),g-c>=0?(e(g-c,v,p),d.subVectors(u,p)):(e(g+c,v,p),d.subVectors(p,u)),v-c>=0?(e(g,v-c,p),f.subVectors(u,p)):(e(g,v+c,p),f.subVectors(p,u)),h.crossVectors(d,f).normalize(),s.push(h.x,h.y,h.z),l.push(g,v)}}for(r=0;r<n;r++)for(i=0;i<t;i++){var y=r*m+i,x=r*m+i+1,b=(r+1)*m+i+1,w=(r+1)*m+i;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.setAttribute("position",new Sa(o,3)),this.setAttribute("normal",new Sa(s,3)),this.setAttribute("uv",new Sa(l,2))}function zc(e,t,n,r){oo.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Uc(e,t,n,r)),this.mergeVertices()}function Uc(e,t,n,r){Na.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1;var i=[],a=[];function o(e,t,n,r){var i,a,o=Math.pow(2,r),l=[];for(i=0;i<=o;i++){l[i]=[];var c=e.clone().lerp(n,i/o),h=t.clone().lerp(n,i/o),u=o-i;for(a=0;a<=u;a++)l[i][a]=0===a&&i===o?c:c.clone().lerp(h,a/u)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var p=Math.floor(a/2);a%2==0?(s(l[i][p+1]),s(l[i+1][p]),s(l[i][p])):(s(l[i][p+1]),s(l[i+1][p+1]),s(l[i+1][p]))}}function s(e){i.push(e.x,e.y,e.z)}function l(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function c(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var n=new Vr,r=new Vr,i=new Vr,a=0;a<t.length;a+=3)l(t[a+0],n),l(t[a+1],r),l(t[a+2],i),o(n,r,i,e)}(r=r||0),function(e){for(var t=new Vr,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){for(var e=new Vr,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=h(e)/2/Math.PI+.5,r=u(e)/Math.PI+.5;a.push(n,1-r)}(function(){for(var e=new Vr,t=new Vr,n=new Vr,r=new Vr,o=new Dr,s=new Dr,l=new Dr,u=0,p=0;u<i.length;u+=9,p+=6){e.set(i[u+0],i[u+1],i[u+2]),t.set(i[u+3],i[u+4],i[u+5]),n.set(i[u+6],i[u+7],i[u+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),l.set(a[p+4],a[p+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=h(r);c(o,p+0,e,d),c(s,p+2,t,d),c(l,p+4,n,d)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4],i=Math.max(t,n,r),o=Math.min(t,n,r);i>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Sa(i,3)),this.setAttribute("normal",new Sa(i.slice(),3)),this.setAttribute("uv",new Sa(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Bc(e,t){oo.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new kc(e,t)),this.mergeVertices()}function kc(e,t){Uc.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Gc(e,t){oo.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Hc(e,t)),this.mergeVertices()}function Hc(e,t){Uc.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function jc(e,t){oo.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Vc(e,t)),this.mergeVertices()}function Vc(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Uc.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Wc(e,t){oo.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new qc(e,t)),this.mergeVertices()}function qc(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Uc.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Xc(e,t,n,r,i,a){oo.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Yc(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Yc(e,t,n,r,i){Na.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new Vr,c=new Vr,h=new Dr,u=new Vr,p=[],d=[],f=[],m=[];function v(i){u=e.getPointAt(i/t,u);var o=a.normals[i],h=a.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*o.x+m*h.x,c.y=v*o.y+m*h.y,c.z=v*o.z+m*h.z,c.normalize(),d.push(c.x,c.y,c.z),l.x=u.x+n*c.x,l.y=u.y+n*c.y,l.z=u.z+n*c.z,p.push(l.x,l.y,l.z)}}!function(){for(o=0;o<t;o++)v(o);v(!1===i?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=r;s++)h.x=o/t,h.y=s/r,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=r;o++){var e=(r+1)*(s-1)+(o-1),n=(r+1)*s+(o-1),i=(r+1)*s+o,a=(r+1)*(s-1)+o;m.push(e,n,a),m.push(n,i,a)}}()}(),this.setIndex(m),this.setAttribute("position",new Sa(p,3)),this.setAttribute("normal",new Sa(d,3)),this.setAttribute("uv",new Sa(f,2))}function Jc(e,t,n,r,i,a,o){oo.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Zc(e,t,n,r,i,a)),this.mergeVertices()}function Zc(e,t,n,r,i,a){Na.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,l=[],c=[],h=[],u=[],p=new Vr,d=new Vr,f=new Vr,m=new Vr,v=new Vr,g=new Vr,y=new Vr;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(A(x,i,a,e,f),A(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*v.x),p.y=f.y+(w*y.y+_*v.y),p.z=f.z+(w*y.z+_*v.z),c.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(o/n),u.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var M=(r+1)*(s-1)+(o-1),S=(r+1)*s+(o-1),E=(r+1)*s+o,T=(r+1)*(s-1)+o;l.push(M,S,T),l.push(S,E,T)}function A(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(l),this.setAttribute("position",new Sa(c,3)),this.setAttribute("normal",new Sa(h,3)),this.setAttribute("uv",new Sa(u,2))}function $c(e,t,n,r,i){oo.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Qc(e,t,n,r,i)),this.mergeVertices()}function Qc(e,t,n,r,i){Na.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],l=[],c=[],h=[],u=new Vr,p=new Vr,d=new Vr;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,m=a/n*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),l.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),c.push(d.x,d.y,d.z),h.push(o/r),h.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var v=(r+1)*a+o-1,g=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute("position",new Sa(l,3)),this.setAttribute("normal",new Sa(c,3)),this.setAttribute("uv",new Sa(h,2))}Pc.prototype=Object.assign(Object.create(vi.prototype),{constructor:Pc,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Tc.copy(n.boundingSphere),Tc.applyMatrix4(r),Tc.radius+=i,!1!==e.ray.intersectsSphere(Tc)){Sc.getInverse(r),Ec.copy(e.ray).applyMatrix4(Sc);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position.array;if(null!==s)for(var c=s.array,h=0,u=c.length;h<u;h++){var p=c[h];Ac.fromArray(l,3*p),Lc(Ac,p,o,r,e,t,this)}else{h=0;for(var d=l.length/3;h<d;h++)Ac.fromArray(l,3*h),Lc(Ac,h,o,r,e,t,this)}}else{var f=n.vertices;for(h=0,d=f.length;h<d;h++)Lc(f[h],h,o,r,e,t,this)}}},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rc.prototype=Object.assign(Object.create(zr.prototype),{constructor:Rc,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Cc.prototype=Object.create(zr.prototype),Cc.prototype.constructor=Cc,Cc.prototype.isCompressedTexture=!0,Ic.prototype=Object.create(zr.prototype),Ic.prototype.constructor=Ic,Ic.prototype.isCanvasTexture=!0,Dc.prototype=Object.create(zr.prototype),Dc.prototype.constructor=Dc,Dc.prototype.isDepthTexture=!0,Oc.prototype=Object.create(Na.prototype),Oc.prototype.constructor=Oc,Nc.prototype=Object.create(oo.prototype),Nc.prototype.constructor=Nc,Fc.prototype=Object.create(Na.prototype),Fc.prototype.constructor=Fc,zc.prototype=Object.create(oo.prototype),zc.prototype.constructor=zc,Uc.prototype=Object.create(Na.prototype),Uc.prototype.constructor=Uc,Bc.prototype=Object.create(oo.prototype),Bc.prototype.constructor=Bc,kc.prototype=Object.create(Uc.prototype),kc.prototype.constructor=kc,Gc.prototype=Object.create(oo.prototype),Gc.prototype.constructor=Gc,Hc.prototype=Object.create(Uc.prototype),Hc.prototype.constructor=Hc,jc.prototype=Object.create(oo.prototype),jc.prototype.constructor=jc,Vc.prototype=Object.create(Uc.prototype),Vc.prototype.constructor=Vc,Wc.prototype=Object.create(oo.prototype),Wc.prototype.constructor=Wc,qc.prototype=Object.create(Uc.prototype),qc.prototype.constructor=qc,Xc.prototype=Object.create(oo.prototype),Xc.prototype.constructor=Xc,Yc.prototype=Object.create(Na.prototype),Yc.prototype.constructor=Yc,Yc.prototype.toJSON=function(){var e=Na.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},Jc.prototype=Object.create(oo.prototype),Jc.prototype.constructor=Jc,Zc.prototype=Object.create(Na.prototype),Zc.prototype.constructor=Zc,$c.prototype=Object.create(oo.prototype),$c.prototype.constructor=$c,Qc.prototype=Object.create(Na.prototype),Qc.prototype.constructor=Qc;var Kc=function(e,t,n){n=n||2;var r,i,a,o,s,l,c,h=t&&t.length,u=h?t[0]*n:e.length,p=eh(e,0,u,n,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=eh(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(uh(o));for(s.sort(sh),i=0;i<s.length;i++)lh(s[i],n),n=th(n,n.next);return n}(e,t,p,n)),e.length>80*n){r=a=e[0],i=o=e[1];for(var f=n;f<u;f+=n)(s=e[f])<r&&(r=s),(l=e[f+1])<i&&(i=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-r,o-i))?1/c:0}return nh(p,d,n,r,i,c),d};function eh(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=wh(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=wh(a,e[a],e[a+1],o);return o&&mh(o,o.next)&&(_h(o),o=o.next),o}function th(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!mh(r,r.next)&&0!==fh(r.prev,r,r.next))r=r.next;else{if(_h(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function nh(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=hh(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,c*=2}while(o>1)}(i)}(e,r,i,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?ih(e,r,i,a):rh(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),_h(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?nh(e=ah(th(e),t,n),t,n,r,i,a,2):2===o&&oh(e,t,n,r,i,a):nh(th(e),t,n,r,i,a,1);break}}}function rh(e){var t=e.prev,n=e,r=e.next;if(fh(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(ph(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&fh(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ih(e,t,n,r){var i=e.prev,a=e,o=e.next;if(fh(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,h=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=hh(s,l,t,n,r),p=hh(c,h,t,n,r),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&ph(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&fh(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&ph(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&fh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&ph(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&fh(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&ph(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&fh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ah(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!mh(i,a)&&vh(i,r,r.next,a)&&xh(i,a)&&xh(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),_h(r),_h(r.next),r=e=a),r=r.next}while(r!==e);return th(r)}function oh(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&dh(o,s)){var l=bh(o,s);return o=th(o,o.next),l=th(l,l.next),nh(o,t,n,r,i,a),void nh(l,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function sh(e,t){return e.x-t.x}function lh(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n;var l,c=n,h=n.x,u=n.y,p=1/0;r=n;do{i>=r.x&&r.x>=h&&i!==r.x&&ph(a<u?i:o,a,h,u,a<u?o:i,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(i-r.x),xh(r,e)&&(l<p||l===p&&(r.x>n.x||r.x===n.x&&ch(n,r)))&&(n=r,p=l)),r=r.next}while(r!==c);return n}(e,t),t){var n=bh(t,e);th(t,t.next),th(n,n.next)}}function ch(e,t){return fh(e.prev,e,t.prev)<0&&fh(t.next,e,e.next)<0}function hh(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function uh(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function ph(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function dh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&vh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(xh(e,t)&&xh(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(fh(e.prev,e,t.prev)||fh(e,t.prev,t))||mh(e,t)&&fh(e.prev,e,e.next)>0&&fh(t.prev,t,t.next)>0)}function fh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function mh(e,t){return e.x===t.x&&e.y===t.y}function vh(e,t,n,r){var i=yh(fh(e,t,n)),a=yh(fh(e,t,r)),o=yh(fh(n,r,e)),s=yh(fh(n,r,t));return i!==a&&o!==s||(!(0!==i||!gh(e,n,t))||(!(0!==a||!gh(e,r,t))||(!(0!==o||!gh(n,e,r))||!(0!==s||!gh(n,t,r)))))}function gh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function yh(e){return e>0?1:e<0?-1:0}function xh(e,t){return fh(e.prev,e,e.next)<0?fh(e,t,e.next)>=0&&fh(e,e.prev,t)>=0:fh(e,t,e.prev)<0||fh(e,e.next,t)<0}function bh(e,t){var n=new Mh(e.i,e.x,e.y),r=new Mh(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function wh(e,t,n,r){var i=new Mh(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function _h(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Mh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Sh={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return Sh.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Eh(e),Th(n,e);var a=e.length;t.forEach(Eh);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Th(n,t[o]);var s=Kc(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function Eh(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Th(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Ah(e,t){oo.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Ph(e,t)),this.mergeVertices()}function Ph(e,t){Na.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:Lh;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);var v,g,y,x,b,w,_,M,S=!1;f&&(v=f.getSpacedPoints(s),S=!0,c=!1,g=f.computeFrenetFrames(s,!1),y=new Vr,x=new Vr,b=new Vr),c||(d=0,h=0,u=0,p=0);var E=e.extractPoints(o),T=E.shape,A=E.holes;if(!Sh.isClockWise(T))for(T=T.reverse(),_=0,M=A.length;_<M;_++)w=A[_],Sh.isClockWise(w)&&(A[_]=w.reverse());var P=Sh.triangulateShape(T,A),L=T;for(_=0,M=A.length;_<M;_++)w=A[_],T=T.concat(w);function R(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var C,I,D,O,N,F,z=T.length,U=P.length;function B(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+s*s,u=o*c-s*l;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(l*l+c*c),f=t.x-s/p,m=t.y+o/p,v=((n.x-c/d-f)*c-(n.y+l/d-m)*l)/(o*c-s*l),g=(r=f+o*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new Dr(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(h)):(r=o,i=s,a=Math.sqrt(h/2))}return new Dr(r/a,i/a)}for(var k=[],G=0,H=L.length,j=H-1,V=G+1;G<H;G++,j++,V++)j===H&&(j=0),V===H&&(V=0),k[G]=B(L[G],L[j],L[V]);var W,q,X=[],Y=k.concat();for(_=0,M=A.length;_<M;_++){for(w=A[_],W=[],G=0,j=(H=w.length)-1,V=G+1;G<H;G++,j++,V++)j===H&&(j=0),V===H&&(V=0),W[G]=B(w[G],w[j],w[V]);X.push(W),Y=Y.concat(W)}for(C=0;C<d;C++){for(D=C/d,O=h*Math.cos(D*Math.PI/2),I=u*Math.sin(D*Math.PI/2)+p,G=0,H=L.length;G<H;G++)Z((N=R(L[G],k[G],I)).x,N.y,-O);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],G=0,H=w.length;G<H;G++)Z((N=R(w[G],W[G],I)).x,N.y,-O)}for(I=u+p,G=0;G<z;G++)N=c?R(T[G],Y[G],I):T[G],S?(x.copy(g.normals[0]).multiplyScalar(N.x),y.copy(g.binormals[0]).multiplyScalar(N.y),b.copy(v[0]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,0);for(q=1;q<=s;q++)for(G=0;G<z;G++)N=c?R(T[G],Y[G],I):T[G],S?(x.copy(g.normals[q]).multiplyScalar(N.x),y.copy(g.binormals[q]).multiplyScalar(N.y),b.copy(v[q]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,l/s*q);for(C=d-1;C>=0;C--){for(D=C/d,O=h*Math.cos(D*Math.PI/2),I=u*Math.sin(D*Math.PI/2)+p,G=0,H=L.length;G<H;G++)Z((N=R(L[G],k[G],I)).x,N.y,l+O);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],G=0,H=w.length;G<H;G++)N=R(w[G],W[G],I),S?Z(N.x,N.y+v[s-1].y,v[s-1].x+O):Z(N.x,N.y,l+O)}function J(e,t){var n,r;for(G=e.length;--G>=0;){n=G,(r=G-1)<0&&(r=e.length-1);var i=0,a=s+2*d;for(i=0;i<a;i++){var o=z*i,l=z*(i+1);Q(t+n+o,t+r+o,t+r+l,t+n+l)}}}function Z(e,t,n){a.push(e),a.push(t),a.push(n)}function $(e,t,i){K(e),K(t),K(i);var a=r.length/3,o=m.generateTopUV(n,r,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function Q(e,t,i,a){K(e),K(t),K(a),K(t),K(i),K(a);var o=r.length/3,s=m.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function K(e){r.push(a[3*e+0]),r.push(a[3*e+1]),r.push(a[3*e+2])}function ee(e){i.push(e.x),i.push(e.y)}!function(){var e=r.length/3;if(c){var t=0,i=z*t;for(G=0;G<U;G++)$((F=P[G])[2]+i,F[1]+i,F[0]+i);for(i=z*(t=s+2*d),G=0;G<U;G++)$((F=P[G])[0]+i,F[1]+i,F[2]+i)}else{for(G=0;G<U;G++)$((F=P[G])[2],F[1],F[0]);for(G=0;G<U;G++)$((F=P[G])[0]+z*s,F[1]+z*s,F[2]+z*s)}n.addGroup(e,r.length/3-e,0)}(),function(){var e=r.length/3,t=0;for(J(L,t),t+=L.length,_=0,M=A.length;_<M;_++)J(w=A[_],t),t+=w.length;n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new Sa(r,3)),this.setAttribute("uv",new Sa(i,2)),this.computeVertexNormals()}Ah.prototype=Object.create(oo.prototype),Ah.prototype.constructor=Ah,Ah.prototype.toJSON=function(){var e=oo.prototype.toJSON.call(this);return Rh(this.parameters.shapes,this.parameters.options,e)},Ph.prototype=Object.create(Na.prototype),Ph.prototype.constructor=Ph,Ph.prototype.toJSON=function(){var e=Na.prototype.toJSON.call(this);return Rh(this.parameters.shapes,this.parameters.options,e)};var Lh={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],c=t[3*i],h=t[3*i+1];return[new Dr(a,o),new Dr(s,l),new Dr(c,h)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*r],h=t[3*r+1],u=t[3*r+2],p=t[3*i],d=t[3*i+1],f=t[3*i+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-h)<.01?[new Dr(o,1-l),new Dr(c,1-u),new Dr(p,1-f),new Dr(m,1-g)]:[new Dr(s,1-l),new Dr(h,1-u),new Dr(d,1-f),new Dr(v,1-g)]}};function Rh(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Ch(e,t){oo.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Ih(e,t)),this.mergeVertices()}function Ih(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new oo;var r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Ph.call(this,r,t),this.type="TextBufferGeometry"}function Dh(e,t,n,r,i,a,o){oo.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Oh(e,t,n,r,i,a,o)),this.mergeVertices()}function Oh(e,t,n,r,i,a,o){Na.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,l,c=Math.min(a+o,Math.PI),h=0,u=[],p=new Vr,d=new Vr,f=[],m=[],v=[],g=[];for(l=0;l<=n;l++){var y=[],x=l/n,b=0;for(0==l&&0==a?b=.5/t:l==n&&c==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var w=s/t;p.x=-e*Math.cos(r+w*i)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(r+w*i)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.copy(p).normalize(),v.push(d.x,d.y,d.z),g.push(w+b,1-x),y.push(h++)}u.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var _=u[l][s+1],M=u[l][s],S=u[l+1][s],E=u[l+1][s+1];(0!==l||a>0)&&f.push(_,M,E),(l!==n-1||c<Math.PI)&&f.push(M,S,E)}this.setIndex(f),this.setAttribute("position",new Sa(m,3)),this.setAttribute("normal",new Sa(v,3)),this.setAttribute("uv",new Sa(g,2))}function Nh(e,t,n,r,i,a){oo.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Fh(e,t,n,r,i,a)),this.mergeVertices()}function Fh(e,t,n,r,i,a){Na.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,l,c=[],h=[],u=[],p=[],d=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new Vr,v=new Dr;for(s=0;s<=r;s++){for(l=0;l<=n;l++)o=i+l/n*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,p.push(v.x,v.y);d+=f}for(s=0;s<r;s++){var g=s*(n+1);for(l=0;l<n;l++){var y=o=l+g,x=o+n+1,b=o+n+2,w=o+1;c.push(y,x,w),c.push(x,b,w)}}this.setIndex(c),this.setAttribute("position",new Sa(h,3)),this.setAttribute("normal",new Sa(u,3)),this.setAttribute("uv",new Sa(p,2))}function zh(e,t,n,r){oo.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new Uh(e,t,n,r)),this.mergeVertices()}function Uh(e,t,n,r){Na.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=Ir.clamp(r,0,2*Math.PI);var i,a,o,s=[],l=[],c=[],h=1/t,u=new Vr,p=new Dr;for(a=0;a<=t;a++){var d=n+a*h*r,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,l.push(u.x,u.y,u.z),p.x=a/t,p.y=o/(e.length-1),c.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute("position",new Sa(l,3)),this.setAttribute("uv",new Sa(c,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,w=new Vr,_=new Vr,M=new Vr;for(i=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[i+o+0],_.y=b[i+o+1],_.z=b[i+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[i+o+0]=M.x,b[o+1]=b[i+o+1]=M.y,b[o+2]=b[i+o+2]=M.z}}function Bh(e,t){oo.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new kh(e,t)),this.mergeVertices()}function kh(e,t){Na.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(e))c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(o,s,l),o+=s,s=0;function c(e){var o,l,c,h=r.length/3,u=e.extractPoints(t),p=u.shape,d=u.holes;for(!1===Sh.isClockWise(p)&&(p=p.reverse()),o=0,l=d.length;o<l;o++)c=d[o],!0===Sh.isClockWise(c)&&(d[o]=c.reverse());var f=Sh.triangulateShape(p,d);for(o=0,l=d.length;o<l;o++)c=d[o],p=p.concat(c);for(o=0,l=p.length;o<l;o++){var m=p[o];r.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,l=f.length;o<l;o++){var v=f[o],g=v[0]+h,y=v[1]+h,x=v[2]+h;n.push(g,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new Sa(r,3)),this.setAttribute("normal",new Sa(i,3)),this.setAttribute("uv",new Sa(a,2))}function Gh(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function Hh(e,t){Na.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,a,o=[],s=Math.cos(Ir.DEG2RAD*t),l=[0,0],c={},h=["a","b","c"];e.isBufferGeometry?(a=new oo).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)n=m[h[v]],r=m[h[(v+1)%3]],l[0]=Math.min(n,r),l[1]=Math.max(n,r),void 0===c[i=l[0]+","+l[1]]?c[i]={index1:l[0],index2:l[1],face1:d,face2:void 0}:c[i].face2=d;for(i in c){var g=c[i];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=u[g.index1];o.push(y.x,y.y,y.z),y=u[g.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new Sa(o,3))}function jh(e,t,n,r,i,a,o,s){oo.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Vh(e,t,n,r,i,a,o,s)),this.mergeVertices()}function Vh(e,t,n,r,i,a,o,s){Na.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var l=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var c=[],h=[],u=[],p=[],d=0,f=[],m=n/2,v=0;function g(n){var i,a,f,g=new Dr,y=new Vr,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(a=d,i=1;i<=r;i++)h.push(0,m*w,0),u.push(0,w,0),p.push(.5,.5),d++;for(f=d,i=0;i<=r;i++){var _=i/r*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,h.push(y.x,y.y,y.z),u.push(0,w,0),g.x=.5*M+.5,g.y=.5*S*w+.5,p.push(g.x,g.y),d++}for(i=0;i<r;i++){var E=a+i,T=f+i;!0===n?c.push(T,T+1,E):c.push(T+1,T,E),x+=3}l.addGroup(v,x,!0===n?1:2),v+=x}!function(){var a,g,y=new Vr,x=new Vr,b=0,w=(t-e)/n;for(g=0;g<=i;g++){var _=[],M=g/i,S=M*(t-e)+e;for(a=0;a<=r;a++){var E=a/r,T=E*s+o,A=Math.sin(T),P=Math.cos(T);x.x=S*A,x.y=-M*n+m,x.z=S*P,h.push(x.x,x.y,x.z),y.set(A,w,P).normalize(),u.push(y.x,y.y,y.z),p.push(E,1-M),_.push(d++)}f.push(_)}for(a=0;a<r;a++)for(g=0;g<i;g++){var L=f[g][a],R=f[g+1][a],C=f[g+1][a+1],I=f[g][a+1];c.push(L,R,I),c.push(R,C,I),b+=6}l.addGroup(v,b,0),v+=b}(),!1===a&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new Sa(h,3)),this.setAttribute("normal",new Sa(u,3)),this.setAttribute("uv",new Sa(p,2))}function Wh(e,t,n,r,i,a,o){jh.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function qh(e,t,n,r,i,a,o){Vh.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function Xh(e,t,n,r){oo.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new Yh(e,t,n,r)),this.mergeVertices()}function Yh(e,t,n,r){Na.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],l=[],c=[],h=new Vr,u=new Dr;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var p=n+a/t*r;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),l.push(0,0,1),u.x=(s[i]/e+1)/2,u.y=(s[i+1]/e+1)/2,c.push(u.x,u.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.setAttribute("position",new Sa(s,3)),this.setAttribute("normal",new Sa(l,3)),this.setAttribute("uv",new Sa(c,2))}Ch.prototype=Object.create(oo.prototype),Ch.prototype.constructor=Ch,Ih.prototype=Object.create(Ph.prototype),Ih.prototype.constructor=Ih,Dh.prototype=Object.create(oo.prototype),Dh.prototype.constructor=Dh,Oh.prototype=Object.create(Na.prototype),Oh.prototype.constructor=Oh,Nh.prototype=Object.create(oo.prototype),Nh.prototype.constructor=Nh,Fh.prototype=Object.create(Na.prototype),Fh.prototype.constructor=Fh,zh.prototype=Object.create(oo.prototype),zh.prototype.constructor=zh,Uh.prototype=Object.create(Na.prototype),Uh.prototype.constructor=Uh,Bh.prototype=Object.create(oo.prototype),Bh.prototype.constructor=Bh,Bh.prototype.toJSON=function(){var e=oo.prototype.toJSON.call(this);return Gh(this.parameters.shapes,e)},kh.prototype=Object.create(Na.prototype),kh.prototype.constructor=kh,kh.prototype.toJSON=function(){var e=Na.prototype.toJSON.call(this);return Gh(this.parameters.shapes,e)},Hh.prototype=Object.create(Na.prototype),Hh.prototype.constructor=Hh,jh.prototype=Object.create(oo.prototype),jh.prototype.constructor=jh,Vh.prototype=Object.create(Na.prototype),Vh.prototype.constructor=Vh,Wh.prototype=Object.create(jh.prototype),Wh.prototype.constructor=Wh,qh.prototype=Object.create(Vh.prototype),qh.prototype.constructor=qh,Xh.prototype=Object.create(oo.prototype),Xh.prototype.constructor=Xh,Yh.prototype=Object.create(Na.prototype),Yh.prototype.constructor=Yh;var Jh=Object.freeze({__proto__:null,WireframeGeometry:Oc,ParametricGeometry:Nc,ParametricBufferGeometry:Fc,TetrahedronGeometry:Bc,TetrahedronBufferGeometry:kc,OctahedronGeometry:Gc,OctahedronBufferGeometry:Hc,IcosahedronGeometry:jc,IcosahedronBufferGeometry:Vc,DodecahedronGeometry:Wc,DodecahedronBufferGeometry:qc,PolyhedronGeometry:zc,PolyhedronBufferGeometry:Uc,TubeGeometry:Xc,TubeBufferGeometry:Yc,TorusKnotGeometry:Jc,TorusKnotBufferGeometry:Zc,TorusGeometry:$c,TorusBufferGeometry:Qc,TextGeometry:Ch,TextBufferGeometry:Ih,SphereGeometry:Dh,SphereBufferGeometry:Oh,RingGeometry:Nh,RingBufferGeometry:Fh,PlaneGeometry:Eo,PlaneBufferGeometry:To,LatheGeometry:zh,LatheBufferGeometry:Uh,ShapeGeometry:Bh,ShapeBufferGeometry:kh,ExtrudeGeometry:Ah,ExtrudeBufferGeometry:Ph,EdgesGeometry:Hh,ConeGeometry:Wh,ConeBufferGeometry:qh,CylinderGeometry:jh,CylinderBufferGeometry:Vh,CircleGeometry:Xh,CircleBufferGeometry:Yh,BoxGeometry:class extends oo{constructor(e,t,n,r,i,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new so(e,t,n,r,i,a)),this.mergeVertices()}},BoxBufferGeometry:so});function Zh(e){da.call(this),this.type="ShadowMaterial",this.color=new sa(0),this.transparent=!0,this.setValues(e)}function $h(e){uo.call(this,e),this.type="RawShaderMaterial"}function Qh(e){da.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new sa(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 sa(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Dr(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function Kh(e){Qh.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Dr(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function eu(e){da.call(this),this.type="MeshPhongMaterial",this.color=new sa(16777215),this.specular=new sa(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sa(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Dr(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function tu(e){da.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new sa(16777215),this.specular=new sa(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sa(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Dr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function nu(e){da.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Dr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ru(e){da.call(this),this.type="MeshLambertMaterial",this.color=new sa(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sa(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function iu(e){da.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new sa(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Dr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function au(e){pc.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Zh.prototype=Object.create(da.prototype),Zh.prototype.constructor=Zh,Zh.prototype.isShadowMaterial=!0,Zh.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this},$h.prototype=Object.create(uo.prototype),$h.prototype.constructor=$h,$h.prototype.isRawShaderMaterial=!0,Qh.prototype=Object.create(da.prototype),Qh.prototype.constructor=Qh,Qh.prototype.isMeshStandardMaterial=!0,Qh.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},Kh.prototype=Object.create(Qh.prototype),Kh.prototype.constructor=Kh,Kh.prototype.isMeshPhysicalMaterial=!0,Kh.prototype.copy=function(e){return Qh.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new sa).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},eu.prototype=Object.create(da.prototype),eu.prototype.constructor=eu,eu.prototype.isMeshPhongMaterial=!0,eu.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},tu.prototype=Object.create(da.prototype),tu.prototype.constructor=tu,tu.prototype.isMeshToonMaterial=!0,tu.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},nu.prototype=Object.create(da.prototype),nu.prototype.constructor=nu,nu.prototype.isMeshNormalMaterial=!0,nu.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ru.prototype=Object.create(da.prototype),ru.prototype.constructor=ru,ru.prototype.isMeshLambertMaterial=!0,ru.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},iu.prototype=Object.create(da.prototype),iu.prototype.constructor=iu,iu.prototype.isMeshMatcapMaterial=!0,iu.prototype.copy=function(e){return da.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},au.prototype=Object.create(pc.prototype),au.prototype.constructor=au,au.prototype.isLineDashedMaterial=!0,au.prototype.copy=function(e){return pc.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var ou=Object.freeze({__proto__:null,ShadowMaterial:Zh,SpriteMaterial:Dl,RawShaderMaterial:$h,ShaderMaterial:uo,PointsMaterial:Mc,MeshPhysicalMaterial:Kh,MeshStandardMaterial:Qh,MeshPhongMaterial:eu,MeshToonMaterial:tu,MeshNormalMaterial:nu,MeshLambertMaterial:ru,MeshDepthMaterial:ml,MeshDistanceMaterial:vl,MeshBasicMaterial:fa,MeshMatcapMaterial:iu,LineDashedMaterial:au,LineBasicMaterial:pc,Material:da}),su={arraySlice:function(e,t,n){return su.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),h=[],u=[],p=0;p<l.times.length;++p){var d=l.times[p]*i;if(!(d<n||d>=r)){h.push(l.times[p]);for(var f=0;f<c;++f)u.push(l.values[p*c+f])}}0!==h.length&&(l.times=su.convertArray(h,l.times.constructor),l.values=su.convertArray(u,l.values.constructor),o.push(l))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===r||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],l=s.ValueTypeName;if("bool"!==l&&"string"!==l){var c=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===l}));if(void 0!==c){var h,u=s.getValueSize(),p=s.times.length-1;if(a<=s.times[0])h=su.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[p]){var d=p*u;h=su.arraySlice(s.values,d)}else{var f=s.createInterpolant();f.evaluate(a),h=f.resultBuffer}if("quaternion"===l)new Gr(h[0],h[1],h[2],h[3]).normalize().conjugate().toArray(h);for(var m=c.times.length,v=0;v<m;++v){var g=v*u;if("quaternion"===l)Gr.multiplyQuaternionsFlat(c.values,g,h,0,c.values,g);else for(var y=0;y<u;++y)c.values[g+y]-=h[y]}}}}return e.blendMode=2501,e}};function lu(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function cu(e,t,n,r){lu.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function hu(e,t,n,r){lu.call(this,e,t,n,r)}function uu(e,t,n,r){lu.call(this,e,t,n,r)}function pu(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=su.convertArray(t,this.TimeBufferType),this.values=su.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function du(e,t,n){pu.call(this,e,t,n)}function fu(e,t,n,r){pu.call(this,e,t,n,r)}function mu(e,t,n,r){pu.call(this,e,t,n,r)}function vu(e,t,n,r){lu.call(this,e,t,n,r)}function gu(e,t,n,r){pu.call(this,e,t,n,r)}function yu(e,t,n,r){pu.call(this,e,t,n,r)}function xu(e,t,n,r){pu.call(this,e,t,n,r)}function bu(e,t,n,r){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==r?r:_r,this.uuid=Ir.generateUUID(),this.duration<0&&this.resetDuration()}function wu(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return mu;case"vector":case"vector2":case"vector3":case"vector4":return xu;case"color":return fu;case"quaternion":return gu;case"bool":case"boolean":return du;case"string":return yu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];su.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(lu.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(lu.prototype,{beforeStart_:lu.prototype.copySampleValue_,afterEnd_:lu.prototype.copySampleValue_}),cu.prototype=Object.assign(Object.create(lu.prototype),{constructor:cu,DefaultSettings_:{endingStart:xr,endingEnd:xr},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case br:i=e,o=2*t-n;break;case wr:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case br:a=e,s=2*n-t;break;case wr:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=a*c},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-t)/(r-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)i[b]=v*a[c+b]+g*a[l+b]+y*a[s+b]+x*a[h+b];return i}}),hu.prototype=Object.assign(Object.create(lu.prototype),{constructor:hu,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(r-t),h=1-c,u=0;u!==o;++u)i[u]=a[l+u]*h+a[s+u]*c;return i}}),uu.prototype=Object.assign(Object.create(lu.prototype),{constructor:uu,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(pu,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:su.convertArray(e.times,Array),values:su.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(pu.prototype,{constructor:pu,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:gr,InterpolantFactoryMethodDiscrete:function(e){return new uu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new hu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new cu(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case vr:t=this.InterpolantFactoryMethodDiscrete;break;case gr:t=this.InterpolantFactoryMethodLinear;break;case yr:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vr;case this.InterpolantFactoryMethodLinear:return gr;case this.InterpolantFactoryMethodSmooth:return yr}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=su.arraySlice(n,i,a),this.values=su.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&su.isTypedArray(r)){o=0;for(var l=r.length;o!==l;++o){var c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=su.arraySlice(this.times),t=su.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===yr,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(r)s=!0;else for(var c=o*n,h=c-n,u=c+n,p=0;p!==n;++p){var d=t[c+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*n,m=i*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++i}}if(a>0){e[i]=e[a];for(f=a*n,m=i*n,p=0;p!==n;++p)t[m+p]=t[f+p];++i}return i!==e.length?(this.times=su.arraySlice(e,0,i),this.values=su.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=su.arraySlice(this.times,0),t=su.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),du.prototype=Object.assign(Object.create(pu.prototype),{constructor:du,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:vr,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),fu.prototype=Object.assign(Object.create(pu.prototype),{constructor:fu,ValueTypeName:"color"}),mu.prototype=Object.assign(Object.create(pu.prototype),{constructor:mu,ValueTypeName:"number"}),vu.prototype=Object.assign(Object.create(lu.prototype),{constructor:vu,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(r-t),c=s+o;s!==c;s+=4)Gr.slerpFlat(i,0,a,s-o,a,s,l);return i}}),gu.prototype=Object.assign(Object.create(pu.prototype),{constructor:gu,ValueTypeName:"quaternion",DefaultInterpolation:gr,InterpolantFactoryMethodLinear:function(e){return new vu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),yu.prototype=Object.assign(Object.create(pu.prototype),{constructor:yu,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:vr,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),xu.prototype=Object.assign(Object.create(pu.prototype),{constructor:xu,ValueTypeName:"vector"}),Object.assign(bu,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(wu(n[i]).scale(r));return new bu(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(pu.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var c=su.getKeyframeOrder(s);s=su.sortedArray(s,1,c),l=su.sortedArray(l,1,c),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new mu(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new bu(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&l.length>1){var c=r[u=l[1]];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var u in r)h.push(bu.CreateFromMorphTargetSequence(u,r[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];su.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,l=e.hierarchy||[],c=0;c<l.length;c++){var h=l[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)u[h[p].morphTargets[d]]=-1;for(var f in u){var m=[],v=[];for(d=0;d!==h[p].morphTargets.length;++d){var g=h[p];m.push(g.time),v.push(g.morphTarget===f?1:0)}r.push(new mu(".morphTargetInfluence["+f+"]",m,v))}a=u.length*(o||1)}else{var y=".bones["+t[c].name+"]";n(xu,y+".position",h,"pos",r),n(gu,y+".quaternion",h,"rot",r),n(xu,y+".scale",h,"scl",r)}}return 0===r.length?null:new bu(i,a,r,s)}}),Object.assign(bu.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new bu(this.name,this.duration,e,this.blendMode)}});var _u={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Mu(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=l.length;t<n;t+=2){var r=l[t],i=l[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}var Su=new Mu;function Eu(e){this.manager=void 0!==e?e:Su,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Eu.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var Tu={};function Au(e){Eu.call(this,e)}function Pu(e){Eu.call(this,e)}function Lu(e){Eu.call(this,e)}function Ru(e){Eu.call(this,e)}function Cu(e){Eu.call(this,e)}function Iu(e){Eu.call(this,e)}function Du(e){Eu.call(this,e)}function Ou(){this.type="Curve",this.arcLengthDivisions=200}function Nu(e,t,n,r,i,a,o,s){Ou.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Fu(e,t,n,r,i,a){Nu.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function zu(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,l*=o,c*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}Au.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Au,load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=_u.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Tu[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],l=!!o[2],c=o[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h="blob"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(c,s);break;case"json":h=JSON.parse(c);break;default:h=c}setTimeout((function(){t&&t(h),i.manager.itemEnd(e)}),0)}catch(g){setTimeout((function(){r&&r(g),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{Tu[e]=[],Tu[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var v in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,r=Tu[e];if(delete Tu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),_u.add(e,n);for(var a=0,o=r.length;a<o;a++){(s=r[a]).onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(a=0,o=r.length;a<o;a++){var s;(s=r[a]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=Tu[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=Tu[e];delete Tu[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=Tu[e];delete Tu[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(e),m}Tu[e].push({onLoad:t,onProgress:n,onError:r})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Pu.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Pu,load:function(e,t,n,r){var i=this,a=new Au(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(a){r?r(a):console.error(a),i.manager.itemError(e)}}),n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=bu.parse(e[n]);t.push(r)}return t}}),Lu.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Lu,load:function(e,t,n,r){var i=this,a=[],o=new Cc;o.image=a;var s=new Au(this.manager);function l(l){s.load(e[l],(function(e){var n=i.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(o.minFilter=ir),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,h=0,u=e.length;h<u;++h)l(h);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=ir),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}),Ru.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Ru,load:function(e,t,n,r){var i=this,a=new yo,o=new Au(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){var n=i.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Kn,a.wrapT=void 0!==n.wrapT?n.wrapT:Kn,a.magFilter=void 0!==n.magFilter?n.magFilter:ir,a.minFilter=void 0!==n.minFilter?n.minFilter:ir,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=ar),1===n.mipmapCount&&(a.minFilter=ir),a.needsUpdate=!0,t&&t(a,n))}),n,r),a}}),Cu.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Cu,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=_u.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),_u.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Iu.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Iu,load:function(e,t,n,r){var i=new ko,a=new Cu(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var l=0;l<e.length;++l)s(l);return i}}),Du.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Du,load:function(e,t,n,r){var i=new zr,a=new Cu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){i.image=n;var r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?pr:dr,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(Ou.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(a-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new Dr:new Vr);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,r,i,a=new Vr,o=[],s=[],l=[],c=new Vr,h=new Qr;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r,new Vr),o[n].normalize();s[0]=new Vr,l[0]=new Vr;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(Ir.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(c,i))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(i=Math.acos(Ir.clamp(s[0].dot(s[e]),-1,1)),i/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(o[n],i*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Nu.prototype=Object.create(Ou.prototype),Nu.prototype.constructor=Nu,Nu.prototype.isEllipseCurve=!0,Nu.prototype.getPoint=function(e,t){for(var n=t||new Dr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=l-this.aY;s=u*c-p*h+this.aX,l=u*h+p*c+this.aY}return n.set(s,l)},Nu.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Nu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Nu.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Fu.prototype=Object.create(Nu.prototype),Fu.prototype.constructor=Fu,Fu.prototype.isArcCurve=!0;var Uu=new Vr,Bu=new zu,ku=new zu,Gu=new zu;function Hu(e,t,n,r){Ou.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function ju(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function Vu(e,t,n,r){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Wu(e,t,n,r,i){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}function qu(e,t,n,r){Ou.call(this),this.type="CubicBezierCurve",this.v0=e||new Dr,this.v1=t||new Dr,this.v2=n||new Dr,this.v3=r||new Dr}function Xu(e,t,n,r){Ou.call(this),this.type="CubicBezierCurve3",this.v0=e||new Vr,this.v1=t||new Vr,this.v2=n||new Vr,this.v3=r||new Vr}function Yu(e,t){Ou.call(this),this.type="LineCurve",this.v1=e||new Dr,this.v2=t||new Dr}function Ju(e,t){Ou.call(this),this.type="LineCurve3",this.v1=e||new Vr,this.v2=t||new Vr}function Zu(e,t,n){Ou.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Dr,this.v1=t||new Dr,this.v2=n||new Dr}function $u(e,t,n){Ou.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Vr,this.v1=t||new Vr,this.v2=n||new Vr}function Qu(e){Ou.call(this),this.type="SplineCurve",this.points=e||[]}Hu.prototype=Object.create(Ou.prototype),Hu.prototype.constructor=Hu,Hu.prototype.isCatmullRomCurve3=!0,Hu.prototype.getPoint=function(e,t){var n,r,i,a,o=t||new Vr,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,h=Math.floor(c),u=c-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===u&&h===l-1&&(h=l-2,u=1),this.closed||h>0?n=s[(h-1)%l]:(Uu.subVectors(s[0],s[1]).add(s[0]),n=Uu),r=s[h%l],i=s[(h+1)%l],this.closed||h+2<l?a=s[(h+2)%l]:(Uu.subVectors(s[l-1],s[l-2]).add(s[l-1]),a=Uu),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(r),p),f=Math.pow(r.distanceToSquared(i),p),m=Math.pow(i.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),Bu.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,d,f,m),ku.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,d,f,m),Gu.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(Bu.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),ku.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),Gu.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(Bu.calc(u),ku.calc(u),Gu.calc(u)),o},Hu.prototype.copy=function(e){Ou.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Hu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Hu.prototype.fromJSON=function(e){Ou.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new Vr).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},qu.prototype=Object.create(Ou.prototype),qu.prototype.constructor=qu,qu.prototype.isCubicBezierCurve=!0,qu.prototype.getPoint=function(e,t){var n=t||new Dr,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Wu(e,r.x,i.x,a.x,o.x),Wu(e,r.y,i.y,a.y,o.y)),n},qu.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},qu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},qu.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Xu.prototype=Object.create(Ou.prototype),Xu.prototype.constructor=Xu,Xu.prototype.isCubicBezierCurve3=!0,Xu.prototype.getPoint=function(e,t){var n=t||new Vr,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Wu(e,r.x,i.x,a.x,o.x),Wu(e,r.y,i.y,a.y,o.y),Wu(e,r.z,i.z,a.z,o.z)),n},Xu.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Xu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Xu.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Yu.prototype=Object.create(Ou.prototype),Yu.prototype.constructor=Yu,Yu.prototype.isLineCurve=!0,Yu.prototype.getPoint=function(e,t){var n=t||new Dr;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Yu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Yu.prototype.getTangent=function(e,t){return(t||new Dr).copy(this.v2).sub(this.v1).normalize()},Yu.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Yu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Yu.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ju.prototype=Object.create(Ou.prototype),Ju.prototype.constructor=Ju,Ju.prototype.isLineCurve3=!0,Ju.prototype.getPoint=function(e,t){var n=t||new Vr;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Ju.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Ju.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ju.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ju.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Zu.prototype=Object.create(Ou.prototype),Zu.prototype.constructor=Zu,Zu.prototype.isQuadraticBezierCurve=!0,Zu.prototype.getPoint=function(e,t){var n=t||new Dr,r=this.v0,i=this.v1,a=this.v2;return n.set(Vu(e,r.x,i.x,a.x),Vu(e,r.y,i.y,a.y)),n},Zu.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Zu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Zu.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},$u.prototype=Object.create(Ou.prototype),$u.prototype.constructor=$u,$u.prototype.isQuadraticBezierCurve3=!0,$u.prototype.getPoint=function(e,t){var n=t||new Vr,r=this.v0,i=this.v1,a=this.v2;return n.set(Vu(e,r.x,i.x,a.x),Vu(e,r.y,i.y,a.y),Vu(e,r.z,i.z,a.z)),n},$u.prototype.copy=function(e){return Ou.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},$u.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},$u.prototype.fromJSON=function(e){return Ou.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Qu.prototype=Object.create(Ou.prototype),Qu.prototype.constructor=Qu,Qu.prototype.isSplineCurve=!0,Qu.prototype.getPoint=function(e,t){var n=t||new Dr,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],c=r[a>r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return n.set(ju(o,s.x,l.x,c.x,h.x),ju(o,s.y,l.y,c.y,h.y)),n},Qu.prototype.copy=function(e){Ou.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},Qu.prototype.toJSON=function(){var e=Ou.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},Qu.prototype.fromJSON=function(e){Ou.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new Dr).fromArray(r))}return this};var Ku=Object.freeze({__proto__:null,ArcCurve:Fu,CatmullRomCurve3:Hu,CubicBezierCurve:qu,CubicBezierCurve3:Xu,EllipseCurve:Nu,LineCurve:Yu,LineCurve3:Ju,QuadraticBezierCurve:Zu,QuadraticBezierCurve3:$u,SplineCurve:Qu});function ep(){Ou.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function tp(e){ep.call(this),this.type="Path",this.currentPoint=new Dr,e&&this.setFromPoints(e)}function np(e){tp.call(this,e),this.uuid=Ir.generateUUID(),this.type="Shape",this.holes=[]}function rp(e,t){vi.call(this),this.type="Light",this.color=new sa(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function ip(e,t,n){rp.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(vi.DefaultUp),this.updateMatrix(),this.groundColor=new sa(t)}function ap(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Dr(512,512),this.map=null,this.mapPass=null,this.matrix=new Qr,this._frustum=new wo,this._frameExtents=new Dr(1,1),this._viewportCount=1,this._viewports=[new Ur(0,0,1,1)]}function op(){ap.call(this,new fo(50,1,.5,500))}function sp(e,t,n,r,i,a){rp.call(this,e,t),this.type="SpotLight",this.position.copy(vi.DefaultUp),this.updateMatrix(),this.target=new vi,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new op}function lp(){ap.call(this,new fo(90,1,.5,500)),this._frameExtents=new Dr(4,2),this._viewportCount=6,this._viewports=[new Ur(2,1,1,1),new Ur(0,1,1,1),new Ur(3,1,1,1),new Ur(1,1,1,1),new Ur(3,0,1,1),new Ur(1,0,1,1)],this._cubeDirections=[new Vr(1,0,0),new Vr(-1,0,0),new Vr(0,0,1),new Vr(0,0,-1),new Vr(0,1,0),new Vr(0,-1,0)],this._cubeUps=[new Vr(0,1,0),new Vr(0,1,0),new Vr(0,1,0),new Vr(0,1,0),new Vr(0,0,1),new Vr(0,0,-1)]}function cp(e,t,n,r){rp.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new lp}function hp(e,t,n,r,i,a){po.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function up(){ap.call(this,new hp(-5,5,5,-5,.5,500))}function pp(e,t){rp.call(this,e,t),this.type="DirectionalLight",this.position.copy(vi.DefaultUp),this.updateMatrix(),this.target=new vi,this.shadow=new up}function dp(e,t){rp.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function fp(e,t,n,r){rp.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function mp(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new Vr)}function vp(e,t){rp.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new mp}function gp(e){Eu.call(this,e),this.textures={}}ep.prototype=Object.assign(Object.create(Ou.prototype),{constructor:ep,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Yu(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Ou.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Ou.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Ou.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push((new Ku[r.type]).fromJSON(r))}return this}}),tp.prototype=Object.assign(Object.create(ep.prototype),{constructor:tp,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new Yu(this.currentPoint.clone(),new Dr(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new Zu(this.currentPoint.clone(),new Dr(e,t),new Dr(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new qu(this.currentPoint.clone(),new Dr(e,t),new Dr(n,r),new Dr(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new Qu([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var l=new Nu(e,t,n,r,i,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var h=l.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return ep.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ep.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ep.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),np.prototype=Object.assign(Object.create(tp.prototype),{constructor:np,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){tp.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=tp.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){tp.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push((new tp).fromJSON(r))}return this}}),rp.prototype=Object.assign(Object.create(vi.prototype),{constructor:rp,isLight:!0,copy:function(e){return vi.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=vi.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),ip.prototype=Object.assign(Object.create(rp.prototype),{constructor:ip,isHemisphereLight:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(ap.prototype,{_projScreenMatrix:new Qr,_lightPositionWorld:new Vr,_lookTarget:new Vr,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),op.prototype=Object.assign(Object.create(ap.prototype),{constructor:op,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*Ir.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),ap.prototype.updateMatrices.call(this,e)}}),sp.prototype=Object.assign(Object.create(rp.prototype),{constructor:sp,isSpotLight:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),lp.prototype=Object.assign(Object.create(ap.prototype),{constructor:lp,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),cp.prototype=Object.assign(Object.create(rp.prototype),{constructor:cp,isPointLight:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),hp.prototype=Object.assign(Object.create(po.prototype),{constructor:hp,isOrthographicCamera:!0,copy:function(e,t){return po.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=vi.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),up.prototype=Object.assign(Object.create(ap.prototype),{constructor:up,isDirectionalLightShadow:!0,updateMatrices:function(e){ap.prototype.updateMatrices.call(this,e)}}),pp.prototype=Object.assign(Object.create(rp.prototype),{constructor:pp,isDirectionalLight:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),dp.prototype=Object.assign(Object.create(rp.prototype),{constructor:dp,isAmbientLight:!0}),fp.prototype=Object.assign(Object.create(rp.prototype),{constructor:fp,isRectAreaLight:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=rp.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(mp.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}),Object.assign(mp,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),vp.prototype=Object.assign(Object.create(rp.prototype),{constructor:vp,isLightProbe:!0,copy:function(e){return rp.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=rp.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),gp.prototype=Object.assign(Object.create(Eu.prototype),{constructor:gp,load:function(e,t,n,r){var i=this,a=new Au(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(a){r?r(a):console.error(a),i.manager.itemError(e)}}),n,r)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var r=new ou[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=(new sa).setHex(e.sheen)),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(r.morphNormals=e.morphNormals),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.vertexTangents&&(r.vertexTangents=e.vertexTangents),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new sa).setHex(a.value);break;case"v2":r.uniforms[i].value=(new Dr).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Vr).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Ur).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new Or).fromArray(a.value);case"m4":r.uniforms[i].value=(new Qr).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new Dr).fromArray(s)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Dr).fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}});var yp=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(i){return t}},xp=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function bp(){Na.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function wp(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),va.call(this,e,t,n),this.meshPerAttribute=r||1}function _p(e){Eu.call(this,e)}bp.prototype=Object.assign(Object.create(Na.prototype),{constructor:bp,isInstancedBufferGeometry:!0,copy:function(e){return Na.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Na.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),wp.prototype=Object.assign(Object.create(va.prototype),{constructor:wp,isInstancedBufferAttribute:!0,copy:function(e){return va.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=va.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),_p.prototype=Object.assign(Object.create(Eu.prototype),{constructor:_p,load:function(e,t,n,r){var i=this,a=new Au(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(a){r?r(a):console.error(a),i.manager.itemError(e)}}),n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new bp:new Na,n=e.data.index;if(void 0!==n){var r=new Mp[n.type](n.array);t.setIndex(new va(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=(r=new Mp[o.type](o.array),new(o.isInstancedBufferAttribute?wp:va)(r,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var c=l[a],h=[],u=0,p=c.length;u<p;u++){o=c[u],s=new va(r=new Mp[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),h.push(s)}t.morphAttributes[a]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new Vr;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new Oi(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Mp={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Sp(e){Eu.call(this,e)}Sp.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Sp,load:function(e,t,n,r){var i=this,a=""===this.path?xp(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Au(i.manager);o.setPath(this.path),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(s){return void 0!==r&&r(s),void console.error("THREE:ObjectLoader: Can't parse "+e+".",s.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new np).fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var r=new _p,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Jh[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Jh[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Jh[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Jh[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Jh[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Jh[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Jh[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Jh[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Jh[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Jh[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Jh[s.type]((new Ku[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Jh[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Jh[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,h=s.shapes.length;c<h;c++){var u=t[s.shapes[c]];l.push(u)}o=new Jh[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,h=s.shapes.length;c<h;c++){u=t[s.shapes[c]];l.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new Ku[p.type]).fromJSON(p)),o=new Jh[s.type](l,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(void 0!==e){var i=new gp;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var h=s.materials[c];void 0===n[h.uuid]&&(n[h.uuid]=i.parse(h)),l.push(n[h.uuid])}r[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=bu.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var a=new Cu(new Mu(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){r[l.uuid]=[];for(var h=0,u=c.length;h<u;h++){var p=c[h],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;r[l.uuid].push(i(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;r[l.uuid]=i(d)}}}return r},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new ko(t[s.image]):new zr(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,Tp)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],Ap),o.wrapT=n(s.wrap[1],Ap)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,Pp)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Pp)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),r[s.uuid]=o}return r},parseObject:function(e,t,n){var r;function i(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":r=new gi,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new sa(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new Pl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new Al(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new fo(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new hp(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new dp(e.color,e.intensity);break;case"DirectionalLight":r=new pp(e.color,e.intensity);break;case"PointLight":r=new cp(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new fp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new sp(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new ip(e.color,e.groundColor,e.intensity);break;case"LightProbe":r=(new vp).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":r=new Ka(o=i(e.geometry),s=a(e.material));break;case"InstancedMesh":var o=i(e.geometry),s=a(e.material),l=e.count,c=e.instanceMatrix;(r=new uc(o,s,l)).instanceMatrix=new va(new Float32Array(c.array),16);break;case"LOD":r=new tc;break;case"Line":r=new yc(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new _c(i(e.geometry),a(e.material));break;case"LineSegments":r=new wc(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new Pc(i(e.geometry),a(e.material));break;case"Sprite":r=new ql(a(e.material));break;case"Group":r=new _l;break;default:r=new vi}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(r.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.frustumCulled&&(r.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(r.renderOrder=e.renderOrder),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.layers&&(r.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)r.add(this.parseObject(h[u],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(r.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=r.getObjectByProperty("uuid",f.object);void 0!==m&&r.addLevel(m,f.distance)}}return r}});var Ep,Tp={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:$n,CubeUVRefractionMapping:307},Ap={RepeatWrapping:Qn,ClampToEdgeWrapping:Kn,MirroredRepeatWrapping:er},Pp={NearestFilter:tr,NearestMipmapNearestFilter:nr,NearestMipmapLinearFilter:rr,LinearFilter:ir,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:ar};function Lp(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Eu.call(this,e),this.options=void 0}function Rp(){this.type="ShapePath",this.color=new sa,this.subPaths=[],this.currentPath=null}function Cp(e){this.type="Font",this.data=e}function Ip(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,l,c,h,u,p,d,f=new Rp;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(o,s);break;case"q":l=m[v++]*t+n,c=m[v++]*t+r,h=m[v++]*t+n,u=m[v++]*t+r,f.quadraticCurveTo(h,u,l,c);break;case"b":l=m[v++]*t+n,c=m[v++]*t+r,h=m[v++]*t+n,u=m[v++]*t+r,p=m[v++]*t+n,d=m[v++]*t+r,f.bezierCurveTo(h,u,p,d,l,c)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".")}function Dp(e){Eu.call(this,e)}Lp.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Lp,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=_u.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)})).then((function(n){_u.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}),Object.assign(Rp.prototype,{moveTo:function(e,t){return this.currentPath=new tp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new np;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[i],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=c*(e.x-o.x)-l*(e.y-o.y);if(0===h)return!0;if(h<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Sh.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new np).curves=s.curves,c.push(l),c;var h=!i(a[0].getPoints());h=e?!h:h;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(u=(s=a[g]).getPoints()),(o=e?!o:o)?(!h&&f[v]&&v++,f[v]={s:new np,p:u},f[v].s.curves=s.curves,h&&v++,m[v]=[]):m[v].push({h:s,p:u[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S<M.length;S++){for(var E=M[S],T=!0,A=0;A<f.length;A++)r(E.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:S}),T?(T=!1,d[A].push(E)):x=!0);T&&d[w].push(E)}b.length>0&&(x||(m=d))}g=0;for(var P=f.length;g<P;g++){l=f[g].s,c.push(l);for(var L=0,R=(p=m[g]).length;L<R;L++)l.holes.push(p[L].h)}return c}}),Object.assign(Cp.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],r=function(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,l=0,c=0;c<r.length;c++){var h=r[c];if("\n"===h)s=0,l-=a;else{var u=Ip(h,i,s,l,n);s+=u.offsetX,o.push(u.path)}}return o}(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Dp.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Dp,load:function(e,t,n,r){var i=this,a=new Au(this.manager);a.setPath(this.path),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(a){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)}),n,r)},parse:function(e){return new Cp(e)}});var Op=function(){return void 0===Ep&&(Ep=new(window.AudioContext||window.webkitAudioContext)),Ep};function Np(e){Eu.call(this,e)}function Fp(e,t,n){vp.call(this,void 0,n);var r=(new sa).set(e),i=(new sa).set(t),a=new Vr(r.r,r.g,r.b),o=new Vr(i.r,i.g,i.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}function zp(e,t){vp.call(this,void 0,t);var n=(new sa).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Np.prototype=Object.assign(Object.create(Eu.prototype),{constructor:Np,load:function(e,t,n,r){var i=this,a=new Au(i.manager);a.setResponseType("arraybuffer"),a.setPath(i.path),a.load(e,(function(n){try{var a=n.slice(0);Op().decodeAudioData(a,(function(e){t(e)}))}catch(o){r?r(o):console.error(o),i.manager.itemError(e)}}),n,r)}}),Fp.prototype=Object.assign(Object.create(vp.prototype),{constructor:Fp,isHemisphereLightProbe:!0,copy:function(e){return vp.prototype.copy.call(this,e),this},toJSON:function(e){return vp.prototype.toJSON.call(this,e)}}),zp.prototype=Object.assign(Object.create(vp.prototype),{constructor:zp,isAmbientLightProbe:!0,copy:function(e){return vp.prototype.copy.call(this,e),this},toJSON:function(e){return vp.prototype.toJSON.call(this,e)}});var Up=new Qr,Bp=new Qr;function kp(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,r,i=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(Ir.DEG2RAD*t.fov*.5)/t.zoom;Bp.elements[12]=-a,Up.elements[12]=a,n=-s*t.aspect+o,r=s*t.aspect+o,i.elements[0]=2*t.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*t.aspect-o,r=s*t.aspect-o,i.elements[0]=2*t.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Bp),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Up)}}),Object.assign(kp.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Gp=new Vr,Hp=new Gr,jp=new Vr,Vp=new Vr;function Wp(){vi.call(this),this.type="AudioListener",this.context=Op(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new kp}function qp(e){vi.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Wp.prototype=Object.assign(Object.create(vi.prototype),{constructor:Wp,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){vi.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gp,Hp,jp),Vp.set(0,0,-1).applyQuaternion(Hp),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Gp.x,r),t.positionY.linearRampToValueAtTime(Gp.y,r),t.positionZ.linearRampToValueAtTime(Gp.z,r),t.forwardX.linearRampToValueAtTime(Vp.x,r),t.forwardY.linearRampToValueAtTime(Vp.y,r),t.forwardZ.linearRampToValueAtTime(Vp.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Gp.x,Gp.y,Gp.z),t.setOrientation(Vp.x,Vp.y,Vp.z,n.x,n.y,n.z)}}),qp.prototype=Object.assign(Object.create(vi.prototype),{constructor:qp,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){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:function(){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:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Xp=new Vr,Yp=new Gr,Jp=new Vr,Zp=new Vr;function $p(e){qp.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function Qp(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Kp(e,t,n){var r,i,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}$p.prototype=Object.assign(Object.create(qp.prototype),{constructor:$p,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(vi.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Xp,Yp,Jp),Zp.set(0,0,1).applyQuaternion(Yp);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Xp.x,n),t.positionY.linearRampToValueAtTime(Xp.y,n),t.positionZ.linearRampToValueAtTime(Xp.z,n),t.orientationX.linearRampToValueAtTime(Zp.x,n),t.orientationY.linearRampToValueAtTime(Zp.y,n),t.orientationZ.linearRampToValueAtTime(Zp.z,n)}else t.setPosition(Xp.x,Xp.y,Xp.z),t.setOrientation(Zp.x,Zp.y,Zp.z)}}}),Object.assign(Qp.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Kp.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){Gr.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;Gr.multiplyQuaternionsFlat(e,a,e,t,e,n),Gr.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}});var ed="\\[\\]\\.:\\/",td=new RegExp("[\\[\\]\\.:\\/]","g"),nd="[^\\[\\]\\.:\\/]",rd="[^"+ed.replace("\\.","")+"]",id=/((?:WC+[\/:])*)/.source.replace("WC",nd),ad=/(WCOD+)?/.source.replace("WCOD",rd),od=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nd),sd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nd),ld=new RegExp("^"+id+ad+od+sd+"$"),cd=["material","materials","bones"];function hd(e,t,n){var r=n||ud.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function ud(e,t,n){this.path=t,this.parsedPath=n||ud.parseTrackName(t),this.node=ud.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function pd(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=new Array(a),s={endingStart:xr,endingEnd:xr},l=0;l!==a;++l){var c=i[l].createInterpolant(null);o[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=o,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}function dd(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function fd(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function md(e,t,n){Ll.call(this,e,t),this.meshPerAttribute=n||1}function vd(e,t,n,r){this.ray=new Hi(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new ni,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function gd(e,t){return e.distance-t.distance}function yd(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)yd(i[a],t,n,!0)}Object.assign(hd.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(ud,{Composite:hd,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new ud.Composite(e,t,n):new ud(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(td,"")},parseTrackName:function(e){var t=ld.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==cd.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(ud.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=ud.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(ud.prototype,{_getValue_unbound:ud.prototype.getValue,_setValue_unbound:ud.prototype.setValue}),Object.assign(function(){this.uuid=Ir.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,h=arguments.length;c!==h;++c){var u=arguments[c],p=u.uuid,d=r[p];if(void 0===d){d=t++,r[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new ud(u,i[f],a[f]))}else if(d<n){l=e[d];var v=--n,g=e[v];r[g.uuid]=d,e[d]=g,r[p]=v,e[v]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],b=y[d];y[d]=x,void 0===b&&(b=new ud(u,i[f],a[f])),y[v]=b}}else e[d]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(void 0!==c&&c>=t){var h=t++,u=e[h];n[u.uuid]=c,e[c]=u,n[l]=h,e[h]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[h],v=f[c];f[c]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,h=r[c];if(void 0!==h)if(delete r[c],h<n){var u=--n,p=e[u],d=e[y=--t];r[p.uuid]=h,e[h]=p,r[d.uuid]=u,e[u]=d,e.pop();for(var f=0,m=a;f!==m;++f){var v=(x=i[f])[u],g=x[y];x[h]=v,x[u]=g,x.pop()}}else{var y;r[(d=e[y=--t]).uuid]=h,e[h]=d,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=i[f])[h]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(h);for(var u=c,p=s.length;u!==p;++u){var d=s[u];h[u]=new ud(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(pd.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;if(2501===this.blendMode)for(var h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(s);else for(h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(r,s)}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=2202===r;if(0===e)return-1===i?t:a&&1==(1&i)?n-t:t;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&i))return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=br,r.endingEnd=br):(r.endingStart=e?this.zeroSlopeAtStart?br:xr:wr,r.endingEnd=t?this.zeroSlopeAtEnd?br:xr:wr)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),dd.prototype=Object.assign(Object.create(Pr.prototype),{constructor:dd,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var h=0;h!==i;++h){var u=r[h],p=u.name,d=c[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new Kp(ud.create(n,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;void 0===i&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new hu(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?bu.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:_r),void 0!==s){var c=s.actionByRoot[i];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var h=new pd(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,i),h},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?bu.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=c,t[c]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),fd.prototype.clone=function(){return new fd(void 0===this.value.clone?this.value:this.value.clone())},md.prototype=Object.assign(Object.create(Ll.prototype),{constructor:md,isInstancedInterleavedBuffer:!0,copy:function(e){return Ll.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(vd.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return yd(e,this,r,t),r.sort(gd),r},intersectObjects:function(e,t,n){var r=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)yd(e[i],this,r,t);return r.sort(gd),r}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ir.clamp(t/this.radius,-1,1))),this}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var xd=new Dr;function bd(e,t){this.min=void 0!==e?e:new Dr(1/0,1/0),this.max=void 0!==t?t:new Dr(-1/0,-1/0)}Object.assign(bd.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=xd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new Dr),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new Dr),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Dr),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Dr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return xd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var wd=new Vr,_d=new Vr;function Md(e,t){this.start=void 0!==e?e:new Vr,this.end=void 0!==t?t:new Vr}function Sd(e){vi.call(this),this.material=e,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}Object.assign(Md.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Vr),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Vr),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Vr),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){wd.subVectors(e,this.start),_d.subVectors(this.end,this.start);var n=_d.dot(_d),r=_d.dot(wd)/n;return t&&(r=Ir.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Vr),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Sd.prototype=Object.create(vi.prototype),Sd.prototype.constructor=Sd,Sd.prototype.isImmediateRenderObject=!0;var Ed=new Vr;function Td(e,t){vi.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Na,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Sa(r,3));var l=new pc({fog:!1,toneMapped:!1});this.cone=new wc(n,l),this.add(this.cone),this.update()}Td.prototype=Object.create(vi.prototype),Td.prototype.constructor=Td,Td.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Td.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Ed.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ed),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Ad=new Vr,Pd=new Qr,Ld=new Qr;function Rd(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,Rd(e.children[n]));return t}function Cd(e){for(var t=Rd(e),n=new Na,r=[],i=[],a=new sa(0,0,1),o=new sa(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new Sa(r,3)),n.setAttribute("color",new Sa(i,3));var c=new pc({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});wc.call(this,n,c),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Id(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Oh(t,4,2),i=new fa({wireframe:!0,fog:!1,toneMapped:!1});Ka.call(this,r,i),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Cd.prototype=Object.create(wc.prototype),Cd.prototype.constructor=Cd,Cd.prototype.isSkeletonHelper=!0,Cd.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");Ld.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Pd.multiplyMatrices(Ld,o.matrixWorld),Ad.setFromMatrixPosition(Pd),r.setXYZ(a,Ad.x,Ad.y,Ad.z),Pd.multiplyMatrices(Ld,o.parent.matrixWorld),Ad.setFromMatrixPosition(Pd),r.setXYZ(a+1,Ad.x,Ad.y,Ad.z),a+=2)}n.getAttribute("position").needsUpdate=!0,vi.prototype.updateMatrixWorld.call(this,e)},Id.prototype=Object.create(Ka.prototype),Id.prototype.constructor=Id,Id.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Id.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Dd=new Vr,Od=new sa,Nd=new sa;function Fd(e,t,n){vi.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new Hc(t);r.rotateY(.5*Math.PI),this.material=new fa({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.setAttribute("color",new va(a,3)),this.add(new Ka(r,this.material)),this.update()}function zd(e,t,n,r){e=e||10,t=t||10,n=new sa(void 0!==n?n:4473924),r=new sa(void 0!==r?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],l=[],c=0,h=0,u=-o;c<=t;c++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=c===i?n:r;p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3}var d=new Na;d.setAttribute("position",new Sa(s,3)),d.setAttribute("color",new Sa(l,3));var f=new pc({vertexColors:!0,toneMapped:!1});wc.call(this,d,f),this.type="GridHelper"}function Ud(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new sa(void 0!==i?i:4473924),a=new sa(void 0!==a?a:8947848);var o,s,l,c,h,u,p,d=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,d.push(0,0,0),d.push(o,0,s),p=1&c?i:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(c=0;c<=n;c++)for(p=1&c?i:a,u=e-e/n*c,h=0;h<r;h++)l=h/r*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),l=(h+1)/r*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new Na;m.setAttribute("position",new Sa(d,3)),m.setAttribute("color",new Sa(f,3));var v=new pc({vertexColors:!0,toneMapped:!1});wc.call(this,m,v),this.type="PolarGridHelper"}Fd.prototype=Object.create(vi.prototype),Fd.prototype.constructor=Fd,Fd.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Fd.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Od.copy(this.light.color),Nd.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Od:Nd;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Dd.setFromMatrixPosition(this.light.matrixWorld).negate())},zd.prototype=Object.assign(Object.create(wc.prototype),{constructor:zd,copy:function(e){return wc.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Ud.prototype=Object.create(wc.prototype),Ud.prototype.constructor=Ud;var Bd=new Vr,kd=new Vr,Gd=new Vr;function Hd(e,t,n){vi.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var r=new Na;r.setAttribute("position",new Sa([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new pc({fog:!1,toneMapped:!1});this.lightPlane=new yc(r,i),this.add(this.lightPlane),(r=new Na).setAttribute("position",new Sa([0,0,0,0,0,1],3)),this.targetLine=new yc(r,i),this.add(this.targetLine),this.update()}Hd.prototype=Object.create(vi.prototype),Hd.prototype.constructor=Hd,Hd.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Hd.prototype.update=function(){Bd.setFromMatrixPosition(this.light.matrixWorld),kd.setFromMatrixPosition(this.light.target.matrixWorld),Gd.subVectors(kd,Bd),this.lightPlane.lookAt(kd),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(kd),this.targetLine.scale.z=Gd.length()};var jd=new Vr,Vd=new po;function Wd(e){var t=new Na,n=new pc({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new sa(16755200),s=new sa(16711680),l=new sa(43775),c=new sa(16777215),h=new sa(3355443);function u(e,t,n){p(e,n),p(t,n)}function p(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new Sa(r,3)),t.setAttribute("color",new Sa(i,3)),wc.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function qd(e,t,n,r,i,a,o){jd.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),c=0,h=s.length;c<h;c++)l.setXYZ(s[c],jd.x,jd.y,jd.z)}Wd.prototype=Object.create(wc.prototype),Wd.prototype.constructor=Wd,Wd.prototype.update=function(){var e=this.geometry,t=this.pointMap;Vd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),qd("c",t,e,Vd,0,0,-1),qd("t",t,e,Vd,0,0,1),qd("n1",t,e,Vd,-1,-1,-1),qd("n2",t,e,Vd,1,-1,-1),qd("n3",t,e,Vd,-1,1,-1),qd("n4",t,e,Vd,1,1,-1),qd("f1",t,e,Vd,-1,-1,1),qd("f2",t,e,Vd,1,-1,1),qd("f3",t,e,Vd,-1,1,1),qd("f4",t,e,Vd,1,1,1),qd("u1",t,e,Vd,.7,1.1,-1),qd("u2",t,e,Vd,-.7,1.1,-1),qd("u3",t,e,Vd,0,2,-1),qd("cf1",t,e,Vd,-1,0,1),qd("cf2",t,e,Vd,1,0,1),qd("cf3",t,e,Vd,0,-1,1),qd("cf4",t,e,Vd,0,1,1),qd("cn1",t,e,Vd,-1,0,-1),qd("cn2",t,e,Vd,1,0,-1),qd("cn3",t,e,Vd,0,-1,-1),qd("cn4",t,e,Vd,0,1,-1),e.getAttribute("position").needsUpdate=!0};var Xd=new Ci;function Yd(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new Na;i.setIndex(new va(n,1)),i.setAttribute("position",new va(r,3)),wc.call(this,i,new pc({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function Jd(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Na;r.setIndex(new va(n,1)),r.setAttribute("position",new Sa([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),wc.call(this,r,new pc({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function Zd(e,t,n){this.plane=e,this.size=void 0===t?1:t;var r=void 0!==n?n:16776960,i=new Na;i.setAttribute("position",new Sa([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),yc.call(this,i,new pc({color:r,toneMapped:!1})),this.type="PlaneHelper";var a=new Na;a.setAttribute("position",new Sa([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Ka(a,new fa({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}Yd.prototype=Object.create(wc.prototype),Yd.prototype.constructor=Yd,Yd.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Xd.setFromObject(this.object),!Xd.isEmpty()){var t=Xd.min,n=Xd.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Yd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Yd.prototype.copy=function(e){return wc.prototype.copy.call(this,e),this.object=e.object,this},Yd.prototype.clone=function(){return(new this.constructor).copy(this)},Jd.prototype=Object.create(wc.prototype),Jd.prototype.constructor=Jd,Jd.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),vi.prototype.updateMatrixWorld.call(this,e))},Zd.prototype=Object.create(yc.prototype),Zd.prototype.constructor=Zd,Zd.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),vi.prototype.updateMatrixWorld.call(this,e)};var $d,Qd,Kd=new Vr;function ef(e,t,n,r,i,a){vi.call(this),this.type="ArrowHelper",void 0===e&&(e=new Vr(0,0,1)),void 0===t&&(t=new Vr(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===$d&&(($d=new Na).setAttribute("position",new Sa([0,0,0,0,1,0],3)),(Qd=new Vh(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new yc($d,new pc({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ka(Qd,new fa({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function tf(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Na;n.setAttribute("position",new Sa(t,3)),n.setAttribute("color",new Sa([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new pc({vertexColors:!0,toneMapped:!1});wc.call(this,n,r),this.type="AxesHelper"}ef.prototype=Object.create(vi.prototype),ef.prototype.constructor=ef,ef.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Kd.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Kd,t)}},ef.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},ef.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},ef.prototype.copy=function(e){return vi.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},ef.prototype.clone=function(){return(new this.constructor).copy(this)},tf.prototype=Object.create(wc.prototype),tf.prototype.constructor=tf;var nf=[.125,.215,.35,.446,.526,.582],rf=5+nf.length;new hp,function(){for(var e=[],t=[],n=[],r=8,i=0;i<rf;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>4?o=nf[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];u.set(g,18*f),p.set(h,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new Na;x.setAttribute("position",new va(u,3)),x.setAttribute("uv",new va(p,2)),x.setAttribute("faceIndex",new va(d,1)),e.push(x),r>4&&r--}}();var af=(1+Math.sqrt(5))/2,of=1/af;function sf(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Hu.call(this,e),this.type="catmullrom"}new Vr(1,1,1),new Vr(-1,1,1),new Vr(1,1,-1),new Vr(-1,1,-1),new Vr(0,af,of),new Vr(0,af,-of),new Vr(of,0,af),new Vr(-of,0,af),new Vr(af,of,0),new Vr(-af,of,0),Ou.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Ou.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(ep.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new oo,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new Vr(i.x,i.y,i.z||0))}return t}}),Object.assign(tp.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),sf.prototype=Object.create(Hu.prototype),Object.assign(sf.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),zd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Cd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Eu.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),xp(e)}}),Eu.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.")}},Object.assign(Sp.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(bd.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Ci.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Oi.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),wo.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Md.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Ir,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Ir.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Ir.ceilPowerOfTwo(e)}}),Object.assign(Or.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Qr.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Vr).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)}}),qi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Gr.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Hi.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(ra.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(ra,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ra.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ra.getNormal(e,t,n,r)}}),Object.assign(np.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ah(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Bh(this,e)}}),Object.assign(Dr.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Vr.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ur.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(oo.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(vi.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(vi.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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.")}}}),Object.assign(Ka.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(Ka.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.")}}}),Object.defineProperties(tc.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ac.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),nc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Ou.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),fo.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(rp.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(va.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."),this.usage===Ar},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ar)}}}),Object.assign(va.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Ar:Tr),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Na.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new va(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Na.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}}}),Object.defineProperties(bp.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(vd.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(Ll.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Ar},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Ll.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Ar:Tr),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Ph.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(fd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(da.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 sa}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(eu.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(uo.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Tl.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Tl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},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(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Sr:Mr}}}),Object.defineProperties(gl.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(Br.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(qp.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Np).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qp.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},vo.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Nr.crossOrigin=void 0,Nr.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Du;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},Nr.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Iu;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},Nr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Nr.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:"117"}}))
2
- /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */;var lf={},cf=void 0,hf=lf;function uf(e,t){var n,r=e.split("."),i=hf;!(r[0]in i)&&i.execScript&&i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||t===cf?i=i[n]?i[n]:i[n]={}:i[n]=t}var pf="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function df(e){var t,n,r,i,a,o,s,l,c,h,u=e.length,p=0,d=Number.POSITIVE_INFINITY;for(l=0;l<u;++l)e[l]>p&&(p=e[l]),e[l]<d&&(d=e[l]);for(t=1<<p,n=new(pf?Uint32Array:Array)(t),r=1,i=0,a=2;r<=p;){for(l=0;l<u;++l)if(e[l]===r){for(o=0,s=i,c=0;c<r;++c)o=o<<1|1&s,s>>=1;for(h=r<<16|l,c=o;c<t;c+=a)n[c]=h;++i}++r,i<<=1,a<<=1}return[n,p,d]}function ff(e,t){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=pf?new Uint8Array(e):e,this.m=!1,this.i=vf,this.r=!1,!t&&(t={})||(t.index&&(this.a=t.index),t.bufferSize&&(this.h=t.bufferSize),t.bufferType&&(this.i=t.bufferType),t.resize&&(this.r=t.resize)),this.i){case mf:this.b=32768,this.c=new(pf?Uint8Array:Array)(32768+this.h+258);break;case vf:this.b=0,this.c=new(pf?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var mf=0,vf=1,gf={t:mf,s:vf};ff.prototype.k=function(){for(;!this.m;){var e=Ff(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var t=this.input,n=this.a,r=this.c,i=this.b,a=t.length,o=cf,s=r.length,l=cf;if(this.d=this.f=0,n+1>=a)throw Error("invalid uncompressed block header: LEN");if(o=t[n++]|t[n++]<<8,n+1>=a)throw Error("invalid uncompressed block header: NLEN");if(o===~(t[n++]|t[n++]<<8))throw Error("invalid uncompressed block header: length verify");if(n+o>t.length)throw Error("input buffer is broken");switch(this.i){case mf:for(;i+o>r.length;){if(o-=l=s-i,pf)r.set(t.subarray(n,n+l),i),i+=l,n+=l;else for(;l--;)r[i++]=t[n++];this.b=i,r=this.e(),i=this.b}break;case vf:for(;i+o>r.length;)r=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(pf)r.set(t.subarray(n,n+o),i),i+=o,n+=o;else for(;o--;)r[i++]=t[n++];this.a=n,this.b=i,this.c=r;break;case 1:this.j(Df,Nf);break;case 2:var c,h,u,p,d=Ff(this,5)+257,f=Ff(this,5)+1,m=Ff(this,4)+4,v=new(pf?Uint8Array:Array)(wf.length),g=cf,y=cf,x=cf,b=cf,w=cf;for(w=0;w<m;++w)v[wf[w]]=Ff(this,3);if(!pf)for(w=m,m=v.length;w<m;++w)v[wf[w]]=0;for(c=df(v),g=new(pf?Uint8Array:Array)(d+f),w=0,p=d+f;w<p;)switch(y=zf(this,c),y){case 16:for(b=3+Ff(this,2);b--;)g[w++]=x;break;case 17:for(b=3+Ff(this,3);b--;)g[w++]=0;x=0;break;case 18:for(b=11+Ff(this,7);b--;)g[w++]=0;x=0;break;default:x=g[w++]=y}h=df(pf?g.subarray(0,d):g.slice(0,d)),u=df(pf?g.subarray(d):g.slice(d)),this.j(h,u);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var yf,xf,bf=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],wf=pf?new Uint16Array(bf):bf,_f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],Mf=pf?new Uint16Array(_f):_f,Sf=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Ef=pf?new Uint8Array(Sf):Sf,Tf=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Af=pf?new Uint16Array(Tf):Tf,Pf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Lf=pf?new Uint8Array(Pf):Pf,Rf=new(pf?Uint8Array:Array)(288);for(yf=0,xf=Rf.length;yf<xf;++yf)Rf[yf]=143>=yf?8:255>=yf?9:279>=yf?7:8;var Cf,If,Df=df(Rf),Of=new(pf?Uint8Array:Array)(30);for(Cf=0,If=Of.length;Cf<If;++Cf)Of[Cf]=5;var Nf=df(Of);function Ff(e,t){for(var n,r=e.f,i=e.d,a=e.input,o=e.a,s=a.length;i<t;){if(o>=s)throw Error("input buffer is broken");r|=a[o++]<<i,i+=8}return n=r&(1<<t)-1,e.f=r>>>t,e.d=i-t,e.a=o,n}function zf(e,t){for(var n,r,i=e.f,a=e.d,o=e.input,s=e.a,l=o.length,c=t[0],h=t[1];a<h&&!(s>=l);)i|=o[s++]<<a,a+=8;if((r=(n=c[i&(1<<h)-1])>>>16)>a)throw Error("invalid code length: "+r);return e.f=i>>r,e.d=a-r,e.a=s,65535&n}function Uf(e,t){var n,r;if(this.input=e,this.a=0,!t&&(t={})||(t.index&&(this.a=t.index),t.verify&&(this.A=t.verify)),n=e[this.a++],r=e[this.a++],(15&n)!==Bf)throw Error("unsupported compression method");if(this.method=Bf,((n<<8)+r)%31!=0)throw Error("invalid fcheck flag:"+((n<<8)+r)%31);if(32&r)throw Error("fdict flag is not supported");this.q=new ff(e,{index:this.a,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}ff.prototype.j=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,a,o,s,l=n.length-258;256!==(i=zf(this,e));)if(256>i)r>=l&&(this.b=r,n=this.e(),r=this.b),n[r++]=i;else for(s=Mf[a=i-257],0<Ef[a]&&(s+=Ff(this,Ef[a])),i=zf(this,t),o=Af[i],0<Lf[i]&&(o+=Ff(this,Lf[i])),r>=l&&(this.b=r,n=this.e(),r=this.b);s--;)n[r]=n[r++-o];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},ff.prototype.w=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,a,o,s,l=n.length;256!==(i=zf(this,e));)if(256>i)r>=l&&(l=(n=this.e()).length),n[r++]=i;else for(s=Mf[a=i-257],0<Ef[a]&&(s+=Ff(this,Ef[a])),i=zf(this,t),o=Af[i],0<Lf[i]&&(o+=Ff(this,Lf[i])),r+s>l&&(l=(n=this.e()).length);s--;)n[r]=n[r++-o];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},ff.prototype.e=function(){var e,t,n=new(pf?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.c;if(pf)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=i[e+32768];if(this.g.push(n),this.l+=n.length,pf)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},ff.prototype.z=function(e){var t,n,r,i=this.input.length/this.a+1|0,a=this.input,o=this.c;return e&&("number"==typeof e.p&&(i=e.p),"number"==typeof e.u&&(i+=e.u)),2>i?n=(r=(a.length-this.a)/this.o[2]/2*258|0)<o.length?o.length+r:o.length<<1:n=o.length*i,pf?(t=new Uint8Array(n)).set(o):t=o,this.c=t},ff.prototype.n=function(){var e,t,n,r,i,a=0,o=this.c,s=this.g,l=new(pf?Uint8Array:Array)(this.l+(this.b-32768));if(0===s.length)return pf?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(t=0,n=s.length;t<n;++t)for(r=0,i=(e=s[t]).length;r<i;++r)l[a++]=e[r];for(t=32768,n=this.b;t<n;++t)l[a++]=o[t];return this.g=[],this.buffer=l},ff.prototype.v=function(){var e,t=this.b;return pf?this.r?(e=new Uint8Array(t)).set(this.c.subarray(0,t)):e=this.c.subarray(0,t):(this.c.length>t&&(this.c.length=t),e=this.c),this.buffer=e},Uf.prototype.k=function(){var e,t,n=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){t=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var r=e;if("string"==typeof r){var i,a,o=r.split("");for(i=0,a=o.length;i<a;i++)o[i]=(255&o[i].charCodeAt(0))>>>0;r=o}for(var s,l=1,c=0,h=r.length,u=0;0<h;){h-=s=1024<h?1024:h;do{c+=l+=r[u++]}while(--s);l%=65521,c%=65521}if(t!==(c<<16|l)>>>0)throw Error("invalid adler-32 checksum")}return e};var Bf=8;uf("Zlib.Inflate",Uf),uf("Zlib.Inflate.prototype.decompress",Uf.prototype.k);var kf,Gf,Hf,jf,Vf={ADAPTIVE:gf.s,BLOCK:gf.t};if(Object.keys)kf=Object.keys(Vf);else for(Gf in kf=[],Hf=0,Vf)kf[Hf++]=Gf;for(Hf=0,jf=kf.length;Hf<jf;++Hf)uf("Zlib.Inflate.BufferType."+(Gf=kf[Hf]),Vf[Gf]);var Wf=lf.Zlib,qf={findSpan:function(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,o=Math.floor((i+a)/2);t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o},calcBasisFunctions:function(e,t,n,r){var i=[],a=[],o=[];i[0]=1;for(var s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;for(var l=0,c=0;c<s;++c){var h=o[c+1],u=a[s-c],p=i[c]/(h+u);i[c]=l+h*p,l=u*p}i[s]=l}return i},calcBSplinePoint:function(e,t,n,r){for(var i=this.findSpan(e,r,t),a=this.calcBasisFunctions(i,r,e,t),o=new Ur(0,0,0,0),s=0;s<=e;++s){var l=n[i-e+s],c=a[s],h=l.w*c;o.x+=l.x*h,o.y+=l.y*h,o.z+=l.z*h,o.w+=l.w*c}return o},calcBasisFunctionDerivatives:function(e,t,n,r,i){for(var a=[],o=0;o<=n;++o)a[o]=0;var s=[];for(o=0;o<=r;++o)s[o]=a.slice(0);var l=[];for(o=0;o<=n;++o)l[o]=a.slice(0);l[0][0]=1;for(var c=a.slice(0),h=a.slice(0),u=1;u<=n;++u){c[u]=t-i[e+1-u],h[u]=i[e+u]-t;for(var p=0,d=0;d<u;++d){var f=h[d+1],m=c[u-d];l[u][d]=f+m;var v=l[d][u-1]/l[u][d];l[d][u]=p+f*v,p=m*v}l[u][u]=p}for(u=0;u<=n;++u)s[0][u]=l[u][n];for(d=0;d<=n;++d){var g=0,y=1,x=[];for(o=0;o<=n;++o)x[o]=a.slice(0);x[0][0]=1;for(var b=1;b<=r;++b){var w=0,_=d-b,M=n-b;d>=b&&(x[y][0]=x[g][0]/l[M+1][_],w=x[y][0]*l[_][M]);var S=d-1<=M?b-1:n-d;for(u=_>=-1?1:-_;u<=S;++u)x[y][u]=(x[g][u]-x[g][u-1])/l[M+1][_+u],w+=x[y][u]*l[_+u][M];d<=M&&(x[y][b]=-x[g][b-1]/l[M+1][d],w+=x[y][b]*l[d][M]),s[b][d]=w;u=g;g=y,y=u}}for(d=n,b=1;b<=r;++b){for(u=0;u<=n;++u)s[b][u]*=d;d*=n-b}return s},calcBSplineDerivatives:function(e,t,n,r,i){for(var a=i<e?i:e,o=[],s=this.findSpan(e,r,t),l=this.calcBasisFunctionDerivatives(s,r,e,a,t),c=[],h=0;h<n.length;++h){var u=(d=n[h].clone()).w;d.x*=u,d.y*=u,d.z*=u,c[h]=d}for(var p=0;p<=a;++p){for(var d=c[s-e].clone().multiplyScalar(l[p][0]),f=1;f<=e;++f)d.add(c[s-e+f].clone().multiplyScalar(l[p][f]));o[p]=d}for(p=a+1;p<=i+1;++p)o[p]=new Ur(0,0,0);return o},calcKoverI:function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;var i=1;for(r=2;r<=t;++r)i*=r;for(r=2;r<=e-t;++r)i*=r;return n/i},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var a=e[i];n[i]=new Vr(a.x,a.y,a.z),r[i]=a.w}for(var o=[],s=0;s<t;++s){var l=n[s].clone();for(i=1;i<=s;++i)l.sub(o[s-i].clone().multiplyScalar(this.calcKoverI(s,i)*r[i]));o[s]=l.divideScalar(r[0])}return o},calcNURBSDerivatives:function(e,t,n,r,i){var a=this.calcBSplineDerivatives(e,t,n,r,i);return this.calcRationalCurveDerivatives(a)},calcSurfacePoint:function(e,t,n,r,i,a,o,s){for(var l=this.findSpan(e,a,n),c=this.findSpan(t,o,r),h=this.calcBasisFunctions(l,a,e,n),u=this.calcBasisFunctions(c,o,t,r),p=[],d=0;d<=t;++d){p[d]=new Ur(0,0,0,0);for(var f=0;f<=e;++f){var m=i[l-e+f][c-t+d].clone(),v=m.w;m.x*=v,m.y*=v,m.z*=v,p[d].add(m.multiplyScalar(h[f]))}}var g=new Ur(0,0,0,0);for(d=0;d<=t;++d)g.add(p[d].multiplyScalar(u[d]));g.divideScalar(g.w),s.set(g.x,g.y,g.z)}},Xf=function(e,t,n,r,i){Ou.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||this.knots.length-1;for(var a=0;a<n.length;++a){var o=n[a];this.controlPoints[a]=new Ur(o.x,o.y,o.z,o.w)}};(Xf.prototype=Object.create(Ou.prototype)).constructor=Xf,Xf.prototype.getPoint=function(e,t){var n=t||new Vr,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=qf.calcBSplinePoint(this.degree,this.knots,this.controlPoints,r);return 1!=i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)},Xf.prototype.getTangent=function(e,t){var n=t||new Vr,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=qf.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n};var Yf=function(){var e,t,n;function r(e){Eu.call(this,e)}function i(e,t){this.textureLoader=e,this.manager=t}function a(){}function o(){}function s(){}function l(){}function c(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function h(){}function u(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function p(e){return e/46186158e3}r.prototype=Object.assign(Object.create(Eu.prototype),{constructor:r,load:function(e,t,n,r){var i=this,a=""===i.path?xp(e):i.path,o=new Au(this.manager);o.setPath(i.path),o.setResponseType("arraybuffer"),o.load(e,(function(n){try{t(i.parse(n,a))}catch(o){r?r(o):console.error(o),i.manager.itemError(e)}}),n,r)},parse:function(t,n){if(o="Kaydara FBX Binary \0",(a=t).byteLength>=o.length&&o===b(a,0,o.length))e=(new l).parse(t);else{var r=b(t);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i<t.length;++i){if(r(1)===t[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(u(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+u(r));e=(new s).parse(r)}var a,o;return new i(new Du(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),i.prototype={constructor:i,parse:function(){t=this.parseConnections();var e=this.parseImages(),r=this.parseTextures(e),i=this.parseMaterials(r),o=this.parseDeformers(),s=(new a).parse(o);return this.parseScene(o,s,i),n},parseConnections:function(){var t=new Map;"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};t.get(r).children.push(o)}));return t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var r=e.Objects.Video;for(var i in r){var a=r[i];if(t[c=parseInt(i)]=a.RelativeFilename||a.Filename,"Content"in a){var o=a.Content instanceof ArrayBuffer&&a.Content.byteLength>0,s="string"==typeof a.Content&&""!==a.Content;if(o||s){var l=this.parseImage(r[i]);n[a.RelativeFilename||a.Filename]=l}}}}for(var c in t){var h=t[c];void 0!==n[h]?t[c]=n[h]:t[c]=t[c].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var a=new Uint8Array(n);return window.URL.createObjectURL(new Blob([a],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var r=e.Objects.Texture;for(var i in r){var a=this.parseTexture(r[i],t);n.set(parseInt(i),a)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,a=void 0!==r?r.value:0,o=void 0!==i?i.value:0;if(n.wrapS=0===a?Qn:Kn,n.wrapT=0===o?Qn:Kn,"Scaling"in e){var s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n},loadTexture:function(e,n){var r,i,a=this.textureLoader.path,o=t.get(e.id).children;void 0!==o&&o.length>0&&void 0!==n[o[0].ID]&&(0!==(r=n[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=e.FileName.slice(-3).toLowerCase();if("tga"===s){var l=this.manager.getHandler(".tga");null===l?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new zr):i=l.load(r)}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new zr):i=this.textureLoader.load(r);return this.textureLoader.setPath(a),i},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var r=e.Objects.Material;for(var i in r){var a=this.parseMaterial(r[i],t);null!==a&&n.set(parseInt(i),a)}}return n},parseMaterial:function(e,n){var r=e.id,i=e.attrName,a=e.ShadingModel;if("object"==typeof a&&(a=a.value),!t.has(r))return null;var o,s=this.parseParameters(e,n,r);switch(a.toLowerCase()){case"phong":o=new eu;break;case"lambert":o=new ru;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),o=new eu}return o.setValues(s),o.name=i,o},parseParameters:function(e,n,r){var i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new sa).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(i.color=(new sa).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new sa).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(i.emissive=(new sa).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new sa).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new sa).fromArray(e.SpecularColor.value));var a=this;return t.get(r).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":i.bumpMap=a.getTexture(n,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=a.getTexture(n,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=a.getTexture(n,e.ID),i.map.encoding=Sr;break;case"DisplacementColor":i.displacementMap=a.getTexture(n,e.ID);break;case"EmissiveColor":i.emissiveMap=a.getTexture(n,e.ID),i.emissiveMap.encoding=Sr;break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=a.getTexture(n,e.ID);break;case"ReflectionColor":i.envMap=a.getTexture(n,e.ID),i.envMap.mapping=303,i.envMap.encoding=Sr;break;case"SpecularColor":i.specularMap=a.getTexture(n,e.ID),i.specularMap.encoding=Sr;break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=a.getTexture(n,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),i},getTexture:function(n,r){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=t.get(r).children[0].ID),n.get(r)},parseDeformers:function(){var n={},r={};if("Deformer"in e.Objects){var i=e.Objects.Deformer;for(var a in i){var o=i[a],s=t.get(parseInt(a));if("Skin"===o.attrType){var l=this.parseSkeleton(s,i);l.ID=a,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=s.parents[0].ID,n[a]=l}else if("BlendShape"===o.attrType){var c={id:a};c.rawTargets=this.parseMorphTargets(s,i),c.id=a,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[a]=c}}}return{skeletons:n,morphTargets:r}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transformLink:(new Qr).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var r=[],i=0;i<e.children.length;i++){var a=e.children[i],o=n[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=t.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r},parseScene:function(r,i,a){n=new _l;var s=this.parseModels(r.skeletons,i,a),l=e.Objects.Model,c=this;s.forEach((function(e){var r=l[e.ID];c.setLookAtProperties(e,r),t.get(e.ID).parents.forEach((function(t){var n=s.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&n.add(e)})),this.bindSkeleton(r.skeletons,i,s),this.createAmbientLight(),this.setupMorphMaterials(),n.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrixWorld=e.parent.matrix);var t=g(e.userData.transformData);e.applyMatrix4(t)}}));var h=(new o).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=h,n=n.children[0]),n.animations=h},parseModels:function(n,r,i){var a=new Map,o=e.Objects.Model;for(var s in o){var l=parseInt(s),c=o[s],h=t.get(l),u=this.buildSkeleton(h,n,l,c.attrName);if(!u){switch(c.attrType){case"Camera":u=this.createCamera(h);break;case"Light":u=this.createLight(h);break;case"Mesh":u=this.createMesh(h,r,i);break;case"NurbsCurve":u=this.createCurve(h,r);break;case"LimbNode":case"Root":u=new oc;break;default:u=new _l}u.name=c.attrName?ud.sanitizeNodeName(c.attrName):"",u.ID=l}this.getTransformData(u,c),a.set(l,u)}return a},buildSkeleton:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){for(var a in t){var o=t[a];o.rawBones.forEach((function(t,a){if(t.ID===e.ID){var s=i;(i=new oc).matrixWorld.copy(t.transformLink),i.name=r?ud.sanitizeNodeName(r):"",i.ID=n,o.bones[a]=i,null!==s&&i.add(s)}}))}})),i},createCamera:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new vi;else{var i=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1);var a=1;void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,l=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,l=r.AspectHeight.value);var c=s/l,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var u=r.FocalLength?r.FocalLength.value:null;switch(i){case 0:n=new fo(h,c,a,o),null!==u&&n.setFocalLength(u);break;case 1:n=new hp(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),n=new vi}}return n},createLight:function(t){var n,r;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(r=n)})),void 0===r)n=new vi;else{var i;i=void 0===r.LightType?0:r.LightType.value;var a=16777215;void 0!==r.Color&&(a=(new sa).fromArray(r.Color.value));var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(i){case 0:n=new cp(a,o,s,1);break;case 1:n=new pp(a,o);break;case 2:var l=Math.PI/3;void 0!==r.InnerAngle&&(l=Ir.degToRad(r.InnerAngle.value));var c=0;void 0!==r.OuterAngle&&(c=Ir.degToRad(r.OuterAngle.value),c=Math.max(c,1)),n=new sp(a,o,s,l,c,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),n=new cp(a,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var r,i=null,a=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?a=o:o.length>0?a=o[0]:(a=new eu({color:13421772}),o.push(a)),"color"in i.attributes&&o.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(o.forEach((function(e){e.skinning=!0})),(r=new nc(i,a)).normalizeSkinWeights()):r=new Ka(i,a),r},createCurve:function(e,t){return new yc(e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),new pc({color:3342591,linewidth:1}))},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?y(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n},setLookAtProperties:function(r,i){"LookAtProperty"in i&&t.get(r.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var i=e.Objects.Model[t.ID];if("Lcl_Translation"in i){var a=i.Lcl_Translation.value;void 0!==r.target?(r.target.position.fromArray(a),n.add(r.target)):r.lookAt((new Vr).fromArray(a))}}}))},bindSkeleton:function(e,n,r){var i=this.parsePoseNodes();for(var a in e){var o=e[a];t.get(parseInt(o.ID)).parents.forEach((function(e){if(n.has(e.ID)){var a=e.ID;t.get(a).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new ac(o.bones),i[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var r in n)if("BindPose"===n[r].attrType){var i=n[r].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new Qr).fromArray(e.Matrix.a)})):t[i.Node]=(new Qr).fromArray(i.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,r=t[0],i=t[1],a=t[2];if(0!==r||0!==i||0!==a){var o=new sa(r,i,a);n.add(new dp(o,1))}}},setupMorphMaterials:function(){var e=this;n.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,r){e.setupMorphMaterial(t,n,r)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,r){var i=e.uuid,a=t.uuid,o=!1;if(n.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===a&&e.uuid!==i&&(o=!0)})):e.material.uuid===a&&e.uuid!==i&&(o=!0))})),!0===o){var s=t.clone();s.morphTargets=!0,void 0===r?e.material=s:e.material[r]=s}else t.morphTargets=!0}},a.prototype={constructor:a,parse:function(n){var r=new Map;if("Geometry"in e.Objects){var i=e.Objects.Geometry;for(var a in i){var o=t.get(parseInt(a)),s=this.parseGeometry(o,i[a],n);r.set(parseInt(a),s)}}return r},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,r){var i=r.skeletons,a=[],o=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);t.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&a.push(r.morphTargets[e.ID])}));var l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=y(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);var h=g(c);return this.genGeometry(n,s,a,h)}},genGeometry:function(e,t,n,r){var i=new Na;e.attrName&&(i.name=e.attrName);var a=this.parseGeoNode(e,t),o=this.genBuffers(a),s=new Sa(o.vertex,3);if(s.applyMatrix4(r),i.setAttribute("position",s),o.colors.length>0&&i.setAttribute("color",new Sa(o.colors,3)),t&&(i.setAttribute("skinIndex",new wa(o.weightsIndices,4)),i.setAttribute("skinWeight",new Sa(o.vertexWeights,4)),i.FBX_Deformer=t),o.normal.length>0){var l=(new Or).getNormalMatrix(r),c=new Sa(o.normal,3);c.applyNormalMatrix(l),i.setAttribute("normal",c)}if(o.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new Sa(o.uvs[t],2))})),a.material&&"AllSame"!==a.material.mappingType){var h=o.materialIndex[0],u=0;if(o.materialIndex.forEach((function(e,t){e!==h&&(i.addGroup(u,t-u,h),h=e,u=t)})),i.groups.length>0){var p=i.groups[i.groups.length-1],d=p.start+p.count;d!==o.materialIndex.length&&i.addGroup(d,o.materialIndex.length-d,h)}0===i.groups.length&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],l=[],c=[],h=[],u=this;return e.vertexIndices.forEach((function(p,d){var m=!1;p<0&&(p^=-1,m=!0);var v=[],g=[];if(a.push(3*p,3*p+1,3*p+2),e.color){var y=f(d,n,p,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[p]&&e.weightTable[p].forEach((function(e){g.push(e.weight),v.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var x=[0,0,0,0],b=[0,0,0,0];g.forEach((function(e,t){var n=e,r=v[t];b.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var a=x[t];x[t]=r,r=a}}))})),v=x,g=b}for(;g.length<4;)g.push(0),v.push(0);for(var w=0;w<4;++w)c.push(g[w]),h.push(v[w])}if(e.normal){y=f(d,n,p,e.normal);o.push(y[0],y[1],y[2])}if(e.material&&"AllSame"!==e.material.mappingType)var _=f(d,n,p,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var r=f(d,n,p,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])})),r++,m&&(u.genFace(t,e,a,_,o,s,l,c,h,r),n++,r=0,a=[],o=[],s=[],l=[],c=[],h=[])})),t},genFace:function(e,t,n,r,i,a,o,s,l,c){for(var h=2;h<c;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(h-1)]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[n[3*h]]),e.vertex.push(t.vertexPositions[n[3*h+1]]),e.vertex.push(t.vertexPositions[n[3*h+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(h-1)]),e.vertexWeights.push(s[4*(h-1)+1]),e.vertexWeights.push(s[4*(h-1)+2]),e.vertexWeights.push(s[4*(h-1)+3]),e.vertexWeights.push(s[4*h]),e.vertexWeights.push(s[4*h+1]),e.vertexWeights.push(s[4*h+2]),e.vertexWeights.push(s[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(h-1)]),e.colors.push(a[3*(h-1)+1]),e.colors.push(a[3*(h-1)+2]),e.colors.push(a[3*h]),e.colors.push(a[3*h+1]),e.colors.push(a[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(h-1)]),e.normal.push(i[3*(h-1)+1]),e.normal.push(i[3*(h-1)+2]),e.normal.push(i[3*h]),e.normal.push(i[3*h+1]),e.normal.push(i[3*h+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(h-1)]),e.uvs[n].push(o[n][2*(h-1)+1]),e.uvs[n].push(o[n][2*h]),e.uvs[n].push(o[n][2*h+1])}))},addMorphTargets:function(t,n,r,i){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var a=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var o=e.Objects.Geometry[r.geoID];void 0!==o&&a.genMorphGeometry(t,n,o,i,r.name)}))}))}},genMorphGeometry:function(e,t,n,r,i){for(var a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),h=0;h<s.length;h++){var u=3*s[h];c[u]=o[3*h],c[u+1]=o[3*h+1],c[u+2]=o[3*h+2]}var p={vertexIndices:a,vertexPositions:c},d=new Sa(this.genBuffers(p).vertex,3);d.name=i||n.attrName,d.applyMatrix4(r),e.morphAttributes.position.push(d)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];return"IndexToDirect"===n&&(i=e.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}},parseMaterialIndices:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===Xf)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new Na;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Na;for(var n,r,i=t-1,a=e.KnotVector.a,o=[],s=e.Points.a,l=0,c=s.length;l<c;l+=4)o.push((new Ur).fromArray(s,l));if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){n=i,r=a.length-1-n;for(l=0;l<i;++l)o.push(o[l])}var h=new Xf(i,a,o,n,r).getPoints(7*o.length),u=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(u,3*t)}));var p=new Na;return p.setAttribute("position",new va(u,3)),p}},o.prototype={constructor:o,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e},parseClips:function(){if(void 0!==e.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var n=this.parseAnimationLayers(t);return this.parseAnimStacks(n)}},parseAnimationCurveNodes:function(){var t=e.Objects.AnimationCurveNode,n=new Map;for(var r in t){var i=t[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){var a={id:i.id,attr:i.attrName,curves:{}};n.set(a.id,a)}}return n},parseAnimationCurves:function(n){var r=e.Objects.AnimationCurve;for(var i in r){var a={id:r[i].id,times:r[i].KeyTime.a.map(p),values:r[i].KeyValueFloat.a},o=t.get(a.id);if(void 0!==o){var s=o.parents[0].ID,l=o.parents[0].relationship;l.match(/X/)?n.get(s).curves.x=a:l.match(/Y/)?n.get(s).curves.y=a:l.match(/Z/)?n.get(s).curves.z=a:l.match(/d|DeformPercent/)&&n.has(s)&&(n.get(s).curves.morph=a)}}},parseAnimationLayers:function(r){var i=e.Objects.AnimationLayer,a=new Map;for(var o in i){var s=[],l=t.get(parseInt(o));if(void 0!==l)l.children.forEach((function(i,a){if(r.has(i.ID)){var o=r.get(i.ID);if(void 0!==o.curves.x||void 0!==o.curves.y||void 0!==o.curves.z){if(void 0===s[a])if(void 0!==(d=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(c=e.Objects.Model[d.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",i);var l={modelName:c.attrName?ud.sanitizeNodeName(c.attrName):"",ID:c.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(e){e.ID===c.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new Qr),"PreRotation"in c&&(l.preRotation=c.PreRotation.value),"PostRotation"in c&&(l.postRotation=c.PostRotation.value),s[a]=l}s[a]&&(s[a][o.attr]=o)}else if(void 0!==o.curves.morph){if(void 0===s[a]){var c,h=t.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,u=t.get(h).parents[0].ID,p=t.get(u).parents[0].ID,d=t.get(p).parents[0].ID;l={modelName:(c=e.Objects.Model[d]).attrName?ud.sanitizeNodeName(c.attrName):"",morphName:e.Objects.Deformer[h].attrName};s[a]=l}s[a][o.attr]=o}}})),a.set(parseInt(o),s)}return a},parseAnimStacks:function(n){var r=e.Objects.AnimationStack,i={};for(var a in r){var o=t.get(parseInt(a)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=n.get(o[0].ID);i[a]={name:r[a].attrName,layer:s}}return i},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new bu(e.name,-1,t)},generateTracks:function(e){var t=[],n=new Vr,r=new Gr,i=new Vr;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new ti).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==a&&t.push(a)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var o=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==o&&t.push(o)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==s&&t.push(s)}if(void 0!==e.DeformPercent){var l=this.generateMorphTrack(e);void 0!==l&&t.push(l)}return t},generateVectorTrack:function(e,t,n,r){var i=this.getTimesForAllAxes(t);return new xu(e+"."+r,i,this.getKeyframeTrackValues(i,t,n))},generateRotationTrack:function(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Ir.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Ir.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Ir.degToRad));var o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,n);void 0!==r&&((r=r.map(Ir.degToRad)).push(a),r=(new ti).fromArray(r),r=(new Gr).setFromEuler(r)),void 0!==i&&((i=i.map(Ir.degToRad)).push(a),i=(new ti).fromArray(i),i=(new Gr).setFromEuler(i).inverse());for(var l=new Gr,c=new ti,h=[],u=0;u<s.length;u+=3)c.set(s[u],s[u+1],s[u+2],a),l.setFromEuler(c),void 0!==r&&l.premultiply(r),void 0!==i&&l.multiply(i),l.toArray(h,u/3*4);return new gu(e+".quaternion",o,h)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new mu(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)},getTimesForAllAxes:function(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})).filter((function(e,t,n){return n.indexOf(e)==t}))},getKeyframeTrackValues:function(e,t,n){var r=n,i=[],a=-1,o=-1,s=-1;return e.forEach((function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a){var n=t.x.values[a];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==o){var l=t.y.values[o];i.push(l),r[1]=l}else i.push(r[1]);if(-1!==s){var c=t.z.values[s];i.push(c),r[2]=c}else i.push(r[2])})),i},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var a=i/180,o=r/a,s=n+o,l=e.times[t-1],c=(e.times[t]-l)/a,h=l+c,u=[],p=[];h<e.times[t];)u.push(h),h+=c,p.push(s),s+=o;e.times=w(e.times,t,u),e.values=w(e.values,t,p)}}}},s.prototype={constructor:s,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new h,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(!i&&!a){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in o?("PoseNode"===n?o.PoseNode.push(i):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==a.id&&(o[n][a.id]=i)):"number"==typeof a.id?(o[n]={},o[n][a.id]=i):"Properties70"!==n&&(o[n]="PoseNode"===n?[i]:i),"number"==typeof a.id&&(i.id=a.id),""!==a.name&&(i.attrName=a.name),""!==a.type&&(i.attrType=a.type),this.pushStack(i)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}},parseNodeProperty:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===r){var o=i.split(",").slice(1),s=parseInt(o[0]),l=parseInt(o[1]),c=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[s,l],c=c.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===a[r]&&(a[r]=[])}"Node"===r&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):"a"!==r?a[r]=i:a.a=i,this.setCurrentProp(a,r),"a"===r&&","!==i.slice(-1)&&(a.a=x(i))}else this.parseNodeSpecialProperty(e,r,i)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=x(t.a))},parseNodeSpecialProperty:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],a=r[1],o=r[2],s=r[3],l=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=x(l)}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:l},this.setCurrentProp(this.getPrevNode(),i)}},l.prototype={constructor:l,parse:function(e){var t=new c(e);t.skip(23);var n=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+n);for(var r=new h;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var a=e.getUint8(),o=e.getString(a);if(0===r)return null;for(var s=[],l=0;l<i;l++)s.push(this.parseProperty(e));var c=s.length>0?s[0]:"",h=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var p=this.parseNode(e,t);null!==p&&this.parseSubNode(o,n,p)}return n.propertyList=s,"number"==typeof c&&(n.id=c),""!==h&&(n.attrName=h),""!==u&&(n.attrType=u),""!==o&&(n.name=o),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var a,o=n.propertyList[0],s=n.propertyList[1],l=n.propertyList[2],c=n.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[o]={type:s,type2:l,flag:c,value:a}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":n=e.getUint32();return e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===Wf&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var o=new c(new Wf.Inflate(new Uint8Array(e.getArrayBuffer(a))).decompress().buffer);switch(t){case"b":case"c":return o.getBooleanArray(r);case"d":return o.getFloat64Array(r);case"f":return o.getFloat32Array(r);case"i":return o.getInt32Array(r);case"l":return o.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},c.prototype={constructor:c,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var r=t.indexOf(0);return r>=0&&(t=t.slice(0,r)),yp(new Uint8Array(t))}},h.prototype={constructor:h,add:function(e,t){this[e]=t}};var d=[];function f(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var a=i*r.dataSize,o=a+r.dataSize;return function(e,t,n,r){for(var i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}(d,r.buffer,a,o)}var m=new ti,v=new Vr;function g(e){var t,n=new Qr,r=new Qr,i=new Qr,a=new Qr,o=new Qr,s=new Qr,l=new Qr,c=new Qr,h=new Qr,u=new Qr,p=new Qr,d=e.inheritType?e.inheritType:0;(e.translation&&n.setPosition(v.fromArray(e.translation)),e.preRotation)&&((t=e.preRotation.map(Ir.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(m.fromArray(t)));e.rotation&&((t=e.rotation.map(Ir.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(m.fromArray(t)));e.postRotation&&((t=e.postRotation.map(Ir.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(m.fromArray(t)));e.scale&&o.scale(v.fromArray(e.scale)),e.scalingOffset&&l.setPosition(v.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(v.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(v.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition(v.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(u=e.parentMatrixWorld);var f=r.multiply(i).multiply(a),g=new Qr;u.extractRotation(g),(new Qr).copyPosition(u);var y=new Qr;y.getInverse(g).multiply(u);var x=new Qr;if(0===d)x.copy(g).multiply(f).multiply(y).multiply(o);else if(1===d)x.copy(g).multiply(y).multiply(f).multiply(o);else{var b=(new Qr).getInverse(o),w=(new Qr).multiply(y).multiply(b);x.copy(g).multiply(f).multiply(w).multiply(o)}var _=(new Qr).getInverse(h),M=(new Qr).getInverse(s),S=new Qr;S.copy(n).multiply(c).multiply(h).multiply(r).multiply(i).multiply(a).multiply(_).multiply(l).multiply(s).multiply(o).multiply(M);var E=(new Qr).copyPosition(S),T=(new Qr).copy(u).multiply(E);return p.copyPosition(T),S=(new Qr).multiply(p).multiply(x)}function y(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function x(e){return e.split(",").map((function(e){return parseFloat(e)}))}function b(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),yp(new Uint8Array(e,t,n))}function w(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return r}();const Jf=(e,t,n)=>{const r=new o.Matrix4,i=new o.Euler(e,t,n,"YXZ");return r.makeRotationFromEuler(i),r};function Zf(e,n){e.traverse((e=>{var r;if("Mesh"===e.type){const i=e,a=Object.assign({map:i.material.map||{}},n);i.material=new t.MeshBasicMaterial(a),i.renderOrder=1,"Mesh"===(null==(r=e.parent)?void 0:r.type)&&(e.renderOrder=e.parent.renderOrder+1)}}))}function $f(e,n){var r,i,a,o,s;const l=null!=(r=null==n?void 0:n.size)?r:512,c=null!=(i=null==n?void 0:n.fontSize)?i:l*(35/256)*1.2,h=null!=(a=null==n?void 0:n.backgroundColor)?a:"rgba(0,0,0,0)",u=null!=(o=null==n?void 0:n.fontColor)?o:"#fff",p=null!=(s=null==n?void 0:n.textAlign)?s:"center",d=document.createElement("canvas");d.setAttribute("width",l+""),d.setAttribute("height",l+"");const f=d.getContext("2d");return f.fillStyle=h,f.fillRect(0,0,l,l),f.font=`${c}px "微软雅黑"`,f.textAlign=p,f.fillStyle=u,f.fillText(e,l/2,.7*l),new t.CanvasTexture(d)}var Qf,Kf={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Kf.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Kf.Bounce.In(2*e):.5*Kf.Bounce.Out(2*e-1)+.5}}},em="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},tm=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=em()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!t;i&&!1===i.update(e,a)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),nm={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=nm.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[n],e[n-1],n-r):a(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,a=nm.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-t,r-o)*i(t,o)*e[o]*a(r,o);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=nm.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),a(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=nm.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Qf=[1],function(e){var t=1;if(Qf[e])return Qf[e];for(var n=e;n>1;n--)t*=n;return Qf[e]=t,t}),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i;return(2*t-2*n+a+o)*(i*s)+(-3*t+3*n-2*a-o)*s+a*i+t}}},rm=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),im=new tm,am=function(){function e(e,t){void 0===t&&(t=im),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Kf.Linear.None,this._interpolationFunction=nm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=rm.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?em()+parseFloat(e):e:em(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,r){for(var i in n){var a=e[i],o=Array.isArray(a),s=o?"array":typeof a,l=!o&&Array.isArray(n[i]);if("undefined"!==s&&"function"!==s){if(l){var c=n[i];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,a)),n[i]=[a].concat(c)}if("object"!==s&&!o||!a||l)void 0===t[i]&&(t[i]=a),o||(t[i]*=1),r[i]=l?n[i].slice().reverse():t[i]||0;else{for(var h in t[i]=o?[]:{},a)t[i][h]=a[h];r[i]=o?[]:{},this._setupProperties(a,t[i],n[i],r[i])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=em()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=em()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=em()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var a=t[i]||0,o=n[i],s=Array.isArray(e[i]),l=Array.isArray(o);!s&&l?e[i]=this._interpolationFunction(o,r):"object"==typeof o&&o?this._updateProperties(e[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(e[i]=a+(o-a)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),om=rm.nextId,sm=im,lm=sm.getAll.bind(sm),cm=sm.removeAll.bind(sm),hm=sm.add.bind(sm),um=sm.remove.bind(sm),pm=sm.update.bind(sm),dm={Easing:Kf,Group:tm,Interpolation:nm,now:em,Sequence:rm,nextId:om,Tween:am,VERSION:"18.6.4",getAll:lm,removeAll:cm,add:hm,remove:um,update:pm};const fm=window.requestAnimationFrame||(e=>setTimeout(e,16)),mm=window.cancelAnimationFrame||clearTimeout;function vm(e,t=0){fm(t<=0?e:()=>vm(e,t-1))}function gm(e,t=60){let n=-1,r=0,i=-1;const a=1e3/t;return n=fm((function t(o){-1===i&&(i=o),n=fm(t),o-r<a||(r=o,e&&e(o-i))})),function(){mm(n)}}const ym=Kf;function xm(e,t,n,r=ym.Linear.None){const i=new am(e).to(t,n).easing(r);vm((()=>i.start(0)));const a=gm((e=>{!1===i.update(e)&&a()})),o=[];return i.onDestroy=e=>(o.push(e),i),i.destroy=function(){let e;for(this.stop(),Object.assign(i,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});e=o.shift();)e();a()},i}var bm=(e=>(e.Clockwise="Clockwise",e.Anticlockwise="Anticlockwise",e.Loop="Loop",e))(bm||{});const wm=2*Math.PI;function _m(e){return(e%wm+wm)%wm}function Mm(e){return e%wm}function Sm(e,t,n){return e+(t-e)*n}const Em=(e,t,n)=>{const r=Math.PI,i=2*r;return e=_m(e),t=_m(t),n===bm.Anticlockwise&&e<t&&(e+=i),n===bm.Clockwise&&t<e&&(t+=i),n===bm.Loop&&t-e>r?Em(e,t,bm.Anticlockwise):n===bm.Loop&&e-t>r?Em(e,t,bm.Clockwise):{from:e,to:t}};function Tm(e,t){return e.x===t.x&&e.y===t.y}function Am(e,t){return Math.abs(e)===1/0&&Math.abs(t)===1/0||Math.abs(e-t)<.001}function Pm(e,t){return(t.y-e.y)/(t.x-e.x)}function Lm(e,t,n){const r=Pm(e[1],e[0]),i=Pm(t[1],t[0]);if(isNaN(r)||isNaN(i))return!1;if(Am(r,i))return!1;if(Rm(e[0],t))return e[0];if(Rm(e[1],t))return e[1];if(Rm(t[0],e))return t[0];if(Rm(t[1],e))return t[1];if(n&&!function(e,t){return Math.max(e[0].x,e[1].x)>=Math.min(t[0].x,t[1].x)&&Math.max(t[0].x,t[1].x)>=Math.min(e[0].x,e[1].x)&&Math.max(e[0].y,e[1].y)>=Math.min(t[0].y,t[1].y)&&Cm(t[0],e[1],e[0])*Cm(e[1],t[1],e[0])>0&&Cm(e[0],t[1],t[0])*Cm(t[1],e[1],t[0])>0?1:0}(e,t))return!1;const a=e[0],o=t[0];if(Math.abs(r)===1/0)return{x:a.x,y:t[1].y-(t[1].x-a.x)*i};if(Math.abs(i)===1/0)return{x:o.x,y:e[1].y-(e[1].x-o.x)*r};const s=(o.y-a.y+r*a.x-i*o.x)/(r-i);return{x:s,y:r*s-r*a.x+a.y}}function Rm(e,t){return!!Tm(e,t[0])||(!!Tm(e,t[1])||(t[0].x-e.x)*(e.x-t[1].x)>=0&&(t[0].y-e.y)*(e.y-t[1].y)>=0&&Am(Pm(t[0],e),Pm(e,t[1])))}function Cm(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function Im(e,t=0){t<=0?requestAnimationFrame(e):requestAnimationFrame((()=>Im(e,t-1)))}const Dm=new o.TextureLoader;class Om extends dm.Tween{constructor(){super(...arguments),__publicField(this,"disposeMethods",[]),__publicField(this,"animationFrameDisposer"),__publicField(this,"onDispose",(e=>(this.disposeMethods.push(e),this))),__publicField(this,"play",(()=>(this.start(0),this.animationFrameDisposer=gm((e=>this.update(e))),this))),__publicField(this,"dispose",(()=>{var e;this.stop(),null==(e=this.animationFrameDisposer)||e.call(this),this.disposeMethods.forEach((e=>e())),this.disposeMethods=[],dm.remove(this)}))}}class Nm{constructor(e,t){__publicField(this,"five"),__publicField(this,"data"),__publicField(this,"config"),__publicField(this,"compassMeshTween"),__publicField(this,"compassMesh"),__publicField(this,"dispose",(()=>{this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off()})),__publicField(this,"loadCompassMesh",(async()=>{var e;const t=(null==(e=this.config)?void 0:e.compassImageUrl)||"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",n=await async function(e){return new Promise(((t,n)=>{Dm.load(e,t,void 0,n)})).then((e=>(e.encoding=o.sRGBEncoding,e)))}(t),r=new o.CircleGeometry(.7,32),i=new o.MeshBasicMaterial({map:n,transparent:!0,opacity:1,depthTest:!1}),a=new o.Mesh(r,i);a.rotateX(-Math.PI/2),a.name="pano-compass-mesh",this.compassMesh=a,this.fixPosition(this.five.panoIndex||0),this.data&&(this.fixRotation(this.data.north_rad),this.five.scene.add(a))})),__publicField(this,"onFivePanoWillArrive",(e=>{var t,n;e!==this.five.panoIndex&&(null==(t=this.compassMeshTween)||t.dispose(),null==(n=this.compassMesh)||n.material.setValues({opacity:0}))})),__publicField(this,"onFivePanoArrived",(e=>{var t,n;0===(null==(t=this.compassMesh)?void 0:t.material.opacity)&&(this.fixPosition(e),null==(n=this.compassMeshTween)||n.dispose(),this.compassMeshTween=function(e,t=dm.Easing.Linear.None){const n=new Om({progress:0}).to({progress:1});return void 0!==e&&n.duration(e),void 0!==t&&n.easing(t),n}(1e3).onUpdate((({progress:e})=>{var t;null==(t=this.compassMesh)||t.material.setValues({opacity:e}),this.five.needsRender=!0})).play())})),this.five=e,this.config=t,e.once("panoLoaded",this.loadCompassMesh),e.once("dispose",this.dispose),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive)}load(e){this.data=e,this.compassMesh&&!this.five.scene.children.includes(this.compassMesh)&&(this.fixRotation(e.north_rad),this.fixPosition(this.five.panoIndex||0),this.five.scene.add(this.compassMesh))}fixPosition(e){if(!this.compassMesh)return;const t=this.five.work.observers[e].standingPosition.clone().add(new o.Vector3(0,.01,0));this.compassMesh.position.copy(t),this.five.needsRender=!0}fixRotation(e){this.compassMesh&&(this.compassMesh.rotateZ(e-Math.PI/2),this.five.needsRender=!0)}}e.CSS3DRenderPlugin=e=>{const r={disposeCallbacks:[]},i=(e,r)=>{const{ratio:i,dpr:a,container:l,mode:c}=r,h=e[0].distanceTo(e[1]),u=e[1].distanceTo(e[2]),p=s(h/i*a),d=s(u/i*a),f=new n.CSS3DObject(l);f.scale.set(i,i,i),l.style.width=p+"px",l.style.height=d+"px",l.style.pointerEvents="none";const m=(v=e[0],g=e[2],new t.Vector3((v.x+g.x)/2,(v.y+g.y)/2,(v.z+g.z)/2));var v,g;const y=e[1].clone().sub(e[0]),x=e[2].clone().sub(e[1]),b=new t.Vector3(0,1,0).angleTo(new t.Vector3(0,x.y,x.z)),w=new t.Vector3(1,0,0).angleTo(new t.Vector3(y.x,0,y.z)),_=y.angleTo(new t.Vector3(y.x,0,y.z)),M=(x.z>0?1:-1)*b,S=(y.z<0?1:-1)*w,E=(y.x>0&&y.y<0||y.x<0&&y.y>0?-1:1)*_;let T;if(f.rotateOnWorldAxis(new t.Vector3(1,0,0),M),f.rotateOnWorldAxis(new t.Vector3(0,1,0),S),f.rotateOnWorldAxis(new t.Vector3(0,0,1),E),f.position.set(m.x,m.y,m.z),"behind"===c){const e=new o.MeshBasicMaterial({opacity:0,transparent:!1,side:o.DoubleSide}),t=new o.PlaneGeometry(p,d);T=new o.Mesh(t,e),T.name="CSS3DRenderPlugin-mesh",T.position.copy(f.position),T.rotation.copy(f.rotation),T.scale.copy(f.scale)}return{css3DObject:f,mesh:T}};return{create3DDomContainer:(...a)=>{var o,c,h;const u=a[0].map((e=>e instanceof t.Vector3?e:l(e))),p=a[1];if((null==u?void 0:u.length)<4)return console.error("points must be equal or greater than than 4");if(!(null==(o=null==e?void 0:e.model)?void 0:o.loaded))return console.error("five.model.loaded is: ",null==(c=null==e?void 0:e.model)?void 0:c.loaded);const d=e.getElement();if(!d)return console.error("five.getElement() is "+d);const f=[],m=(null==p?void 0:p.ratio)||.00216;m<=.00215&&console.warn("if you need click css3DElement on safari, ratio must be greater than 0.00215");const v=(null==p?void 0:p.dpr)||1,g=(null==p?void 0:p.mode)||"front",y=null==(h=null==p?void 0:p.autoRender)||h,x=(null==p?void 0:p.behindFiveContainer)||d.parentElement||document.body,b=(null==p?void 0:p.container)||document.createElement("div");b.classList.add("__Dnalogel-plugin--CSS3DRenderPlugin");const{css3DObject:w,mesh:_}=i(u,{ratio:m,dpr:v,container:b,mode:g});let M;const S="front"===g&&!r.frontMode,E="behind"===g&&!r.behindMode,T=!(S||E);let A=!1,P=null;E&&(r.behindMode={scene:new t.Scene,css3DRenderer:new n.CSS3DRenderer}),S&&(r.frontMode={scene:new t.Scene,css3DRenderer:new n.CSS3DRenderer});const{scene:L,css3DRenderer:R}="behind"===g?r.behindMode:r.frontMode,C=(()=>{if(T)return()=>{L.add(w)};{const t=()=>{const e=s(d.clientWidth,{smaller:!0}),t=s(d.clientHeight,{smaller:!0});R.setSize(e,t)};t(),M=function(e,t){if(t&&"undefined"!=typeof ResizeObserver){const n=new ResizeObserver(e);return{observe:()=>n.observe(t),unobserve:()=>n.unobserve(t)}}return{observe:()=>window.addEventListener("resize",e),unobserve:()=>window.removeEventListener("resize",e)}}(t,d),R.domElement.style.position="absolute",R.domElement.style.top="0",R.domElement.style.userSelect="none",R.domElement.style.pointerEvents="none";const n=()=>{A||(P=requestAnimationFrame(n),R.render(L,e.camera))};return()=>{var t;L.add(w),null==(t=null==M?void 0:M.observe)||t.call(M),n(),"behind"===g&&_&&(e.scene.add(_),f.push((()=>_&&e.scene.remove(_))))}}})();if(S){(d.parentElement||document.body).appendChild(R.domElement)}if(E){x.appendChild(R.domElement)}const I=()=>{var e;return A=!0,f.forEach((e=>null==e?void 0:e())),L.remove(w),"number"==typeof P&&cancelAnimationFrame(P),0===L.children.length&&(R.domElement.remove(),"front"===g&&(r.frontMode=void 0),"behind"===g&&(r.behindMode=void 0),r.behindMode||r.frontMode||null==(e=null==M?void 0:M.unobserve)||e.call(M)),!0},D=r.disposeCallbacks.findIndex((e=>e===I));return-1!==D?r.disposeCallbacks.splice(D,1):r.disposeCallbacks.push(I),y&&C(),{container:b,dispose:I,css3DObject:w,render:y?void 0:C}},disposeAll:()=>{r.disposeCallbacks.forEach((e=>null==e?void 0:e())),r.disposeCallbacks=[]}}},e.CameraMovementPlugin=e=>{const t={};return{move:async(n,r,i={preload:!0})=>(t.interruptCallback&&t.interruptCallback(!1),i.asyncStartCallback&&await i.asyncStartCallback(),n.mode&&n.mode!==e.currentMode&&await e.changeMode(n.mode),i.preload&&void 0!==n.panoIndex&&n.panoIndex!==e.panoIndex&&await e.preloadPano(n.panoIndex),i.asyncEndCallback&&await i.asyncEndCallback(),void 0===n.panoIndex&&void 0===n.fov&&void 0===n.latitude&&void 0===n.longitude||await new Promise(((t,i)=>{const a=void 0!==n.panoIndex?n.panoIndex:e.panoIndex;void 0!==a?e.moveToPano(a,Object.assign({duration:r,moveEndCallback:()=>t(!0),moveCancelCallback:()=>i(!1)},n)):i(!1)}))),rotate:async(n,r,a={})=>{t.interruptCallback&&t.interruptCallback(!1),a.asyncStartCallback&&await a.asyncStartCallback(),e.currentMode!==i.Five.Mode.Panorama&&await e.changeMode(i.Five.Mode.Panorama),void 0!==n.panoIndex&&n.panoIndex!==e.panoIndex&&(a.preload&&await e.preloadPano(n.panoIndex),await new Promise(((t,r)=>{n.panoIndex?e.moveToPano(n.panoIndex,{moveEndCallback:()=>t(!0),moveCancelCallback:()=>r(!1)}):t(!0)}))),a.asyncEndCallback&&await a.asyncEndCallback();const{from:o,to:s}=(t=>{const n=e.state,r=Mm(n.latitude),i=Mm(t.latitude),{from:a,to:o}=Em(n.longitude,t.longitude,t.rotation||bm.Loop);return{from:{latitude:r,longitude:a,fov:n.fov},to:{latitude:i,longitude:o,fov:t.fov}}})(n);return await new Promise((i=>{const a=function(e,t){return xm({progress:0},{progress:1},e,t)}(n.rotateSpeed?Math.ceil(Math.abs(s.longitude-o.longitude)/n.rotateSpeed*1e3):r,Kf.Linear.None).onUpdate((({progress:t})=>{const n={};n.longitude=Sm(o.longitude,s.longitude,t),n.latitude=Sm(o.latitude,s.latitude,t),n.fov=Sm(o.fov,s.fov,t),e.setState(n,!0)})).onComplete((()=>{i(!0)})).onDestroy((()=>{i(!1)}));n.rotation===bm.Loop&&a.repeat(1/0).yoyo(!0),t.interruptCallback=(e=!0)=>{a.destroy(),t.interruptCallback=void 0,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),i(e)},t.timeoutId=setTimeout((()=>{t.interruptCallback&&t.interruptCallback(!0)}),r)}))}}},e.ModelChassisCompassPlugin=(e,t)=>{const n=t.fbx_url||"//vrlab-static.ljcdn.com/release/web/v3/dipan3/dipan.FBX",r=t.north_rad||void 0,i={},a=({latitude:e})=>{if(!i.object)return;const t=s(e);t&&(i.object.position.y=t)},s=e=>{if(void 0===i.yBase)return;if(e>=Math.PI/4)return i.yBase-2.2;const t=e*(4/Math.PI);return i.yBase-(.6*t+1.6)};return{load:async t=>{const a=(null==t?void 0:t.fbx_url)||n,s=(null==t?void 0:t.north_rad)||r;if(!s)throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const l=e.model.bounding,c=l.max.x-l.min.x,h=l.max.z-l.min.z,u=Math.max(c,h),p=new Yf,d=await p.loadAsync(a);Zf(d,{transparent:!0,side:o.DoubleSide,blending:o.AdditiveBlending});const f=[0,s-Math.PI/2,0],{model:{bounding:{max:{x:m,z:v},min:{x:g,y:y,z:x}}}}=e;i.yBase=y;return((e,{scale:t,rotation:n,position:r})=>{if(t&&e.scale.set(t,t,t),n){const[t,r,i]=n;t&&e.applyMatrix4(Jf(t,0,0)),r&&e.applyMatrix4(Jf(0,r,0)),i&&e.applyMatrix4(Jf(0,0,i))}r&&e.position.set(r.x,r.y,r.z)})(d,{position:{x:(m+g)/2,y:y-1.6,z:(v+x)/2},rotation:f,scale:.0045*u}),i.object=d,!0},disable:()=>{i.object&&(e.scene.remove(i.object),e.needsRender=!0,e.off("cameraDirectionUpdate",a))},enable:()=>{if(!i.object)return;const t=s(e.getPose().latitude);t&&(i.object.position.y=t),e.scene.add(i.object),e.needsRender=!0,e.on("cameraDirectionUpdate",a)}}},e.ModelEntryDoorGuidePlugin=(e,n)=>{var r,i,a;const s={},c=null==(r=n.animationEnabled)||r,h=null!=(i=n.position)?i:void 0,u=null!=(a=n.rad)?a:void 0,p=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",d=[],f=()=>{if(s.animation)return;if(!s.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",s.object);const n=new t.AnimationMixer(s.object);d.push(n);const r=n.clipAction(s.object.animations[0]);let i;r.timeScale=1;const a={play:()=>{i||(r.play(),i=(()=>{let t=0,n=0;const r=i=>{t=requestAnimationFrame(r);const a=i-n;a<33.333333333333336||(n=i,d.forEach((e=>e.update(a/1e3))),e.needsRender=!0)};return t=requestAnimationFrame(r),()=>{cancelAnimationFrame(t)}})(),requestAnimationFrame((()=>{s.object&&s.object.rotation.z!==s.rad&&(s.object.rotation.z=s.rad)})))},stop:()=>{r.stop(),null==i||i(),i=void 0}};s.animation=a},m=t=>{var n;if(!s.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",s.object);(null!=(n=null==t?void 0:t.animationEnable)?n:c)&&(s.animation||f(),s.animation.play()),e.scene.add(s.object),e.needsRender=!0},v=t=>"Floorplan"===t?m():void(s.object&&(s.animation&&s.animation.stop(),e.scene.remove(s.object),e.needsRender=!0));return{load:async e=>{var n,r,i,a,c,d,f;const m=null!=(n=null==e?void 0:e.position)?n:h;if(!m)return Promise.reject("ModelEntryDoorGuidePlugin.load(): position is undefined");const v=l(m),g=null!=(r=null==e?void 0:e.rad)?r:u,y=null!=(i=null==e?void 0:e.fbx_url)?i:p;if(s.rad=g,void 0===g)return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${g}`);const x=await(new Yf).loadAsync(y);x.position.copy(v),x.rotation.z=g,x.scale.set(.8,.8,.8),Zf(x,{transparent:!0,side:o.DoubleSide});const b=null==(f=null==(d=null==(c=null==(a=x.children)?void 0:a[0])?void 0:c.children)?void 0:d[3])?void 0:f.clone();return b?(b.material=new t.MeshBasicMaterial({transparent:!0,map:$f("入户门")}),b.renderOrder=3,x.children[0].add(b),s.object=x,!0):Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${b}`)},enable:t=>(s.enabled||(s.enabled=!0,v(e.currentMode),e.on("modeChange",v),m(t)),!0),disable:()=>!s.enabled||(s.enabled=!1,e.off("modeChange",v),!0)}},e.ModelFloorplanPlugin=(e,t)=>new Jn(e,t),e.ModelRoomLabelPlugin=e=>new ze(e),e.ModelViewPlugin=e=>{let t=!0;const n=new o.Scene,r=new o.PerspectiveCamera(60,1,.1,1e3);let i=new o.Object3D;{const e=new o.DirectionalLight(16777215,.5);e.position.copy(new o.Vector3(1,1,1)),n.add(e)}{const e=new o.DirectionalLight(16777215,.3);n.add(e)}{const e=new o.AmbientLight(16777215,.3);n.add(e)}n.add(i);let a=null;const s=(e={})=>{if(!a)return;const n=a.domElement.parentNode;if(n&&n.nodeName){const{width:t=n.offsetWidth,height:i=n.offsetHeight}=e;a.setSize(t,i),r.aspect=t/i,r.updateProjectionMatrix()}t=!0},l=()=>{const{longitude:n,latitude:i}=e.getPose(),a=(()=>{const t=e.model.bounding,{fov:n,aspect:i}=r,a=Math.sqrt(Math.pow(t.max.x-t.min.x+2,2)+Math.pow(t.max.y-t.min.y+2,2)+Math.pow(t.max.z-t.min.z+2,2));let o=a/2/Math.tan(Math.PI*n/360);return i<1&&(o/=i),isNaN(o)?a:o})(),s=e.model.bounding.getCenter(new o.Vector3),l=a*Math.cos(i),c=new o.Vector3;c.x=Math.sin(n)*l+s.x,c.z=Math.cos(n)*l+s.z,c.y=Math.sin(i)*a+s.y,r.position.copy(c),r.lookAt(s),t=!0};return e.on("modelLoaded",(()=>{function t(e){return(e=e.clone()).uniforms.modelAlpha.value=1,e.uniforms.map.value&&(e.uniforms.map.value.needsUpdate=!0),e}n.remove(i),i=function e(n){if(n instanceof o.Mesh){const e=n.geometry,r=Array.isArray(n.material)?n.material.map(t):t(n.material);return new o.Mesh(e,r)}if(n instanceof o.Group){const t=new o.Group;return n.children.forEach((n=>t.add(e(n)))),t}{const t=new o.Object3D;return n.children.forEach((n=>t.add(e(n)))),t}}(e.model),n.add(i),l()})),e.on("modelWillLoad",(()=>{i.traverse((e=>{if(e instanceof o.Mesh){[].concat(e.material).forEach((e=>e.dispose()))}})),n.remove(i),i=new o.Object3D,n.add(i),l()})),e.on("cameraDirectionUpdate",l),e.on("dispose",(()=>{a&&a.dispose(),a=null})),e.on("renderFrame",(()=>{if(!0!==t)return;if(!a)return;if(!a.domElement.parentNode)return;0!==a.domElement.parentNode.offsetWidth&&(a.render(n,r),t=!1)})),{appendTo:(t,n={})=>{const r=(()=>{if(e.renderer)return a||(a=new o.WebGLRenderer({antialias:!1,alpha:!0}),a.setPixelRatio(e.renderer.getPixelRatio()),a.outputEncoding=o.sRGBEncoding,a.setClearColor(1579548,0),a.autoClear=!0),a})();if(!r)return;t.appendChild(r.domElement),s(n);const i=window.getComputedStyle(t).position;"relative"!==i&&"absolute"!==i&&"fixed"!==i&&"sticky"!==i&&(t.style.position="relative")},refresh:s}},e.PanoCompassPluginPlugin=function(e,t){return new Nm(e,t)},e.PanoCursorRaycasterPlugin=e=>{const n={intersection:null,disposers:[]},r=e=>{n.intersection=e},i=()=>{n.intersection=null};e.on("modelLoaded",(()=>{e.on("intersectionOnModelUpdate",r),e.on("intersectionHidden",i)})),e.on("dispose",(()=>{e.off("intersectionOnModelUpdate",r),e.off("intersectionHidden",i)}));const a=()=>{var t,a;null==(a=null==(t=n.disposers)?void 0:t.forEach)||a.call(t,(e=>null==e?void 0:e())),e.off("intersectionOnModelUpdate",r),e.off("intersectionHidden",i)},o=(t,n)=>{const r=t.clone();return e.camera.position.clone().sub(r).setLength(n).add(r)};return{intersection:()=>n.intersection,pointAxesHelper:(r,i=2,a=.1)=>{const s=i/2,l=o(r,a),h=new t.Group;h.add(c(new t.Vector3(l.x+s,l.y,l.z),new t.Vector3(l.x-s,l.y,l.z),new t.Vector3(1,0,0)),c(new t.Vector3(l.x,l.y+s,l.z),new t.Vector3(l.x,l.y-s,l.z),new t.Vector3(0,1,0)),c(new t.Vector3(l.x,l.y,l.z+s),new t.Vector3(l.x,l.y,l.z-s),new t.Vector3(0,0,1))),e.scene.add(h),e.needsRender=!0;const u=()=>{e.scene.remove(h)};return n.disposers.push(u),{clear:u,pointAxesHelperMesh:h}},movePointTowardsCamera:o,destroy:a,dispose:a,canSeePoint:(n,r=0)=>{var i,a;const o=null==(i=null==e?void 0:e.camera)?void 0:i.position;if(!o)return!1;const s=n.distanceTo(o),l=n.sub(o).normalize(),c=new t.Raycaster(o,l),h=null==(a=e.model.intersectRaycaster(c))?void 0:a[0];return!(h&&h.distance+r<s)}}},e.PanoFloorplanRadarPlugin=(e,t)=>new Bn(e,t),e.PanoRulerPlugin=(e,n)=>{const r={enable:!1,loaded:!1,options:n.options||{distanceText:e=>`${e.toFixed(1)}m`}},a=(e,t)=>{const n=`\n <div class="PanoRulerPlugin-rule-line">\n <em></em>\n <div class="PanoRulerPlugin-rule-label">\n <div class="PanoRulerPlugin-rule-label-name">${r.options.distanceText(t)}</div>\n </div>\n </div>\n `,i=document.createElement("div");return i.setAttribute("class","PanoRulerPlugin-rule"),i.setAttribute("data-name",e),i.setAttribute("style","display: none"),i.innerHTML=n,i},o=document.createElement("div");o.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML="<style type=\"text/css\">\n.PanoRulerPlugin-rule-line {\n position: absolute;\n transform-origin: left center;\n width: 0;\n height: 0.0625rem;\n}\n\n.PanoRulerPlugin-rule-line::after {\n content: '';\n position: absolute;\n left: -0.125rem;\n top: -0.1rem;\n width: 0.25rem;\n height: 0.25rem;\n border-radius: 50%;\n background: #FFFFFF;\n z-index: 1;\n animation: viewport-rule-point 0.1s 1s;\n animation-fill-mode: both;\n}\n\n.PanoRulerPlugin-rule-line::before {\n content: '';\n position: absolute;\n right: -0.125rem;\n top: -0.1rem;\n width: 0.25rem;\n height: 0.25rem;\n border-radius: 50%;\n background: #FFFFFF;\n animation: viewport-rule-point 0.1s 1.5s;\n animation-fill-mode: both;\n}\n\n.PanoRulerPlugin-rule-line em {\n background: #fff;\n display: block;\n height: 100%;\n animation: viewport-rule-line 0.5s ease 1s;\n animation-fill-mode: both;\n box-shadow: 0 0 0.25rem rgb(0 0 0 / 40%);\n}\n\n.PanoRulerPlugin-rule-label {\n position: absolute;\n width: 0;\n height: 0;\n top: 0.0625rem;\n}\n\n.PanoRulerPlugin-rule-label-name {\n position: absolute;\n padding: 0.1875rem 0.375rem;\n background: rgba(195,195,195,0.30);\n backdrop-filter: blur(0.25rem);\n border-radius: 6.25rem;\n border: 0.0625rem solid rgba(255,255,255,0.6);\n white-space: nowrap;\n overflow: hidden;\n color: #FFFFFF;\n font-weight: 500;\n font-size: 0.75rem;\n line-height: 1;\n -webkit-animation: viewport-rule-label 0.25s ease 1s;\n animation: viewport-rule-label 0.25s ease 1s;\n animation-fill-mode: both;\n box-shadow: inset 0 0 0.625rem 0 rgba(255,255,255,0.30);\n}\n\n@keyframes viewport-rule-line {\n 0% { width: 0% }\n 100% { width: 100% }\n}\n\n@keyframes viewport-rule-label {\n 0% { opacity: 0; transform: scaleX(0); }\n 100% { opacity: 1; transform: translate(-50%, -50%) scaleX(1); }\n}\n\n@keyframes viewport-rule-point {\n 0% { transform: scaleX(0); }\n 100% { transform: scaleX(1); }\n}\n</style>\n",o.appendChild(s);const l={},c=(n,i)=>{if(r.loaded)throw new Error("标尺被重复初始化!");const s=((e,n)=>{const r={},i=new t.Raycaster,a=n.work;if(!a)return r;const o=e.observers;a.observers.forEach(((a,s)=>{const{standingPosition:l}=a,c=new t.Vector3(l.x,l.y,l.z);i.set(c,new t.Vector3(0,1,0));const[h]=n.model.intersectRaycaster(i),u=h?h.point.y:2.7,p=o[s];if(!p)return r;const d=e.rooms[p].name;void 0===r[d]?r[d]={__roof:[u],__floor:[c.y]}:(r[d].__roof.push(u),r[d].__floor.push(c.y))}));for(const t in r){const e=r[t];e.__roof.sort(),e.__floor.sort(),e.floor=e.__floor[~~(e.__floor.length/2)],e.roof=e.__roof[e.__roof.length-1]}return r})(n,e),c=e.work;if(!c)return!1;for(const e in i){const r=i[e],{standingPosition:h}=c.observers[0],u=r.map((({x:e,z:r,observers:i})=>{const a=i.length>0?n.rooms[n.observers[i[0]]].name:"",o=s[a]?s[a].floor:null;let l=1/0,u={index:0,x:h.x,y:h.y,z:h.z};i.forEach((t=>{if(!c.observers[t])return;const{standingPosition:n}=c.observers[t],i={index:t,x:n.x,y:n.y,z:n.z},a=(s={x:e,z:r},h=i,Math.sqrt(Math.pow(s.z-h.z,2)+Math.pow(s.x-h.x,2)));var s,h;o?a<l&&Math.abs(i.y-o)<.3&&(l=a,u=i):a<l&&(l=a,u=i)}));const p=new t.Vector3(e,u.y,r);Object.assign(p,{observers:i});const d=s[a]?s[a].roof:null,f=d?new t.Vector3(e,d,r):null;f&&Object.assign(f,{observers:i});return{origin:p,vertical:f}}));l[e]={origins:u.map((e=>e.origin)),rules:[]};for(const{origin:t,vertical:n}of u){if(!n)continue;const r=a(e,t.distanceTo(n));o.append(r),l[e].rules.push({vertical:!0,rule:[t,n],$element:r})}for(let t=0;t<u.length;t++){let n=t+1;n>=u.length&&(n=0);const{origin:r}=u[t],{origin:i}=u[n],s=a(e,r.distanceTo(i));o.append(s),l[e].rules.push({vertical:!1,rule:[r,i],$element:s})}}return r.loaded=!0,!0},h=async(t,i,a)=>{const o=t||n.roomInfo,s=i||n.roomRules;if(!o||!s)throw new Error("标尺数据依赖不齐全!");return r.options=Object.assign({},r.options,a||{}),e.model.loaded?c(o,s):await new Promise((t=>e.once("modelLoaded",(()=>t(c(o,s))))))};n.roomInfo&&n.roomRules&&h(n.roomInfo,n.roomRules);const u=(e,t,n,r)=>{const i=[[{x:0,y:0},{x:n,y:0}],[{x:0,y:0},{x:0,y:r}],[{x:n,y:0},{x:n,y:r}],[{x:0,y:r},{x:n,y:r}]],a=[];for(let o=0;o<i.length;o++){const n=Lm([e,t],[i[o][0],i[o][1]],!0);n&&a.push(n)}return 0!==a.length&&a},p=()=>{var n;const a=null==(n=e.getElement())?void 0:n.parentElement;if(!a)return;if(!r.loaded)return;if(Object.keys(l).length<=0)return;const{panoIndex:o,camera:s,currentMode:c}=e;if(void 0===o)return;let h;for(const e in l)e.split(",").indexOf(o.toString())>=0&&(h=e);if(!h)return;const p=s.position,d=s.getWorldDirection(new t.Vector3),f=a.clientWidth,m=a.clientHeight;if(c!==i.Five.Mode.Panorama){for(const e in l)for(const{$element:t}of l[e].rules)t.style.display="none";return}for(const e in l)for(const{$element:t}of l[e].rules)t.style.display=e===h?"block":"none";const[v]=l[h].origins.slice().filter((e=>e.observers.indexOf(o)>=0)).sort(((e,t)=>e.clone().setY(0).sub(p).normalize().angleTo(d.clone().setY(0))-t.clone().setY(0).sub(p).normalize().angleTo(d.clone().setY(0))));for(const{rule:e,vertical:r,$element:i}of l[h].rules){const[n,r]=e,a=i.querySelector(".PanoRulerPlugin-rule-line");if(!a)return;if(!v){i.style.display="none";continue}if(n!==v&&r!==v){i.style.display="none";continue}if(n.distanceTo(r)<.5){i.style.display="none";continue}if(-1===n.observers.indexOf(o)||-1===r.observers.indexOf(o)){i.style.display="none";continue}if(n.clone().sub(p).normalize().angleTo(d)>Math.PI/2){i.style.display="none";continue}if(r.clone().sub(p).normalize().angleTo(d)>Math.PI/2){i.style.display="none";continue}const l=n.distanceTo(r);if(r.clone().sub(r.clone().sub(n).divide(new t.Vector3(2,2,2))).distanceTo(p)/l>8){i.style.display="none";continue}const c=n.clone().project(s),h=(c.x+1)/2*f,g=(1-c.y)/2*m,y=r.clone().project(s),x=(y.x+1)/2*f,b=(1-y.y)/2*m,w=Math.sqrt(Math.pow(x-h,2)+Math.pow(b-g,2));let _=w,M=50;const S=u({x:~~h,y:~~g},{x:~~x,y:~~b},f,m);if(S&&1===S.length&&(v===n?(_=Math.sqrt(Math.pow(S[0].x-h,2)+Math.pow(S[0].y-g,2)),M=_/w*50):v===r&&(_=Math.sqrt(Math.pow(S[0].x-x,2)+Math.pow(S[0].y-b,2)),M=100-_/w*50)),S&&2===S.length){const e={x:(S[0].x+S[1].x)/2,y:(S[0].y+S[1].y)/2};M=Math.sqrt(Math.pow(e.x-h,2)+Math.pow(e.y-g,2))/w*100}const E=(Math.PI/2-Math.atan2(x-h,g-b))/Math.PI*180,T=a.querySelector(".PanoRulerPlugin-rule-label"),A=T.children[0].clientWidth;A>=w||A/2>=M/100*w||A/2>=(1-M/100)*w?a.style.display="none":(a.style.width=w+"px",a.style.left=h+"px",a.style.top=g+"px",a.style.transform=`rotate(${-E}deg)`,T.style.left=`${M}%`)}},d=()=>Im(p),f=_n(p,80);return{enable:()=>{var t,n;return!!r.loaded&&(r.enable||(o.setAttribute("class","PanoRulerPlugin"+(r.options.className?" "+r.options.className:"")),null==(n=null==(t=e.getElement())?void 0:t.parentElement)||n.append(o),p(),e.on("panoArrived",p),e.on("modeChange",p),e.on("cameraDirectionUpdate",d),e.on("movingToPano",d),e.on("mouseWheel",f),e.on("pinchGesture",f),r.enable=!0),!0)},disable:()=>!r.enable||(e.off("panoArrived",p),e.off("modeChange",p),e.off("cameraDirectionUpdate",d),e.off("movingToPano",d),e.off("mouseWheel",f),e.off("pinchGesture",f),o&&o.remove(),r.enable=!1,!0),load:h,state:r}},e.TopviewFloorplanPlugin=(e,t)=>new wn(e,t),Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
1
+ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three"),require("three/examples/jsm/renderers/CSS3DRenderer"),require("@realsee/five/line"),require("@realsee/five")):"function"==typeof define&&define.amd?define(["exports","three","three/examples/jsm/renderers/CSS3DRenderer","@realsee/five/line","@realsee/five"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dnalogel={},e.THREE,e.CSS3DRenderer,e.FiveSDK_Line,e.five)}(this,(function(e,t,n,i,r){"use strict";function o(e){if(e&&e.__esModule)return e;var t={__proto__:null,[Symbol.toStringTag]:"Module"};return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function s(e,t){const n=Math.round(e);return n%2==0?n:n+Number((null==t?void 0:t.smaller)?-1:1)}const l=({x:e,y:n,z:i})=>new t.Vector3(e,n,i);const c=e=>{const i={disposeCallbacks:[]},r=(e,i)=>{const{ratio:r,dpr:o,container:l,mode:c}=i,h=e[0].distanceTo(e[1]),u=e[1].distanceTo(e[2]),p=s(h/r*o),d=s(u/r*o),f=new n.CSS3DObject(l);f.scale.set(r,r,r),l.style.width=p+"px",l.style.height=d+"px",l.style.pointerEvents="none";const m=(v=e[0],g=e[2],new t.Vector3((v.x+g.x)/2,(v.y+g.y)/2,(v.z+g.z)/2));var v,g;const y=e[1].clone().sub(e[0]),x=e[2].clone().sub(e[1]),b=new t.Vector3(0,1,0).angleTo(new t.Vector3(0,x.y,x.z)),w=new t.Vector3(1,0,0).angleTo(new t.Vector3(y.x,0,y.z)),_=y.angleTo(new t.Vector3(y.x,0,y.z)),M=(x.z>0?-1:1)*b,E=(y.z<0?1:-1)*w,S=(y.x>0&&y.y<0||y.x<0&&y.y>0?-1:1)*_;let A;if(f.rotateOnWorldAxis(new t.Vector3(1,0,0),M),f.rotateOnWorldAxis(new t.Vector3(0,1,0),E),f.rotateOnWorldAxis(new t.Vector3(0,0,1),S),f.position.set(m.x,m.y,m.z),"behind"===c){const e=new a.MeshBasicMaterial({opacity:0,transparent:!1,side:a.DoubleSide}),t=new a.PlaneGeometry(p,d);A=new a.Mesh(t,e),A.name="CSS3DRenderPlugin-mesh",A.position.copy(f.position),A.rotation.copy(f.rotation),A.scale.copy(f.scale)}return{css3DObject:f,mesh:A}};return{create3DDomContainer:(...o)=>{var a,c,h;const u=o[0].map((e=>e instanceof t.Vector3?e:l(e))),p=o[1];if((null==u?void 0:u.length)<4)return console.error("points must be equal or greater than than 4");if(!(null==(a=null==e?void 0:e.model)?void 0:a.loaded))return console.error("five.model.loaded is: ",null==(c=null==e?void 0:e.model)?void 0:c.loaded);const d=e.getElement();if(!d)return console.error("five.getElement() is "+d);const f=[],m=(null==p?void 0:p.ratio)||.00216;m<=.00215&&console.warn("if you need click css3DElement on safari, ratio must be greater than 0.00215");const v=(null==p?void 0:p.dpr)||1,g=(null==p?void 0:p.mode)||"front",y=null==(h=null==p?void 0:p.autoRender)||h,x=(null==p?void 0:p.behindFiveContainer)||d.parentElement||document.body,b=(null==p?void 0:p.container)||document.createElement("div");b.classList.add("__Dnalogel-plugin--CSS3DRenderPlugin");const{css3DObject:w,mesh:_}=r(u,{ratio:m,dpr:v,container:b,mode:g});let M;const E="front"===g&&!i.frontMode,S="behind"===g&&!i.behindMode,A=!(E||S);let T=!1,P=null;S&&(i.behindMode={scene:new t.Scene,css3DRenderer:new n.CSS3DRenderer}),E&&(i.frontMode={scene:new t.Scene,css3DRenderer:new n.CSS3DRenderer});const{scene:L,css3DRenderer:C}="behind"===g?i.behindMode:i.frontMode,I=(()=>{if(A)return()=>{L.add(w)};{const t=()=>{const e=s(d.clientWidth,{smaller:!0}),t=s(d.clientHeight,{smaller:!0});C.setSize(e,t)};t(),M=function(e,t){if(t&&"undefined"!=typeof ResizeObserver){const n=new ResizeObserver(e);return{observe:()=>n.observe(t),unobserve:()=>n.unobserve(t)}}return{observe:()=>window.addEventListener("resize",e),unobserve:()=>window.removeEventListener("resize",e)}}(t,d),C.domElement.style.position="absolute",C.domElement.style.top="0",C.domElement.style.userSelect="none",C.domElement.style.pointerEvents="none";const n=()=>{T||(P=requestAnimationFrame(n),C.render(L,e.camera))};return()=>{var t;L.add(w),null==(t=null==M?void 0:M.observe)||t.call(M),n(),"behind"===g&&_&&(e.scene.add(_),f.push((()=>_&&e.scene.remove(_))))}}})();if(E){(d.parentElement||document.body).appendChild(C.domElement)}if(S){x.appendChild(C.domElement)}const R=()=>{var e;return T=!0,f.forEach((e=>null==e?void 0:e())),L.remove(w),"number"==typeof P&&cancelAnimationFrame(P),0===L.children.length&&(C.domElement.remove(),"front"===g&&(i.frontMode=void 0),"behind"===g&&(i.behindMode=void 0),i.behindMode||i.frontMode||null==(e=null==M?void 0:M.unobserve)||e.call(M)),!0},O=i.disposeCallbacks.findIndex((e=>e===R));return-1!==O?i.disposeCallbacks.splice(O,1):i.disposeCallbacks.push(R),y&&I(),{container:b,dispose:R,css3DObject:w,render:y?void 0:I}},disposeAll:()=>{i.disposeCallbacks.forEach((e=>null==e?void 0:e())),i.disposeCallbacks=[]}}};function h(e,n,r=new t.Vector3(1,1,1),o=!1){const a=new i.Line(e,n);return a.setMaterial({dashed:o,color:r,linewidth:1}),a.remove(a.points),a}function u(){}const p=e=>e;function d(e,t){for(const n in t)e[n]=t[n];return e}function f(e){return e()}function m(){return Object.create(null)}function v(e){e.forEach(f)}function g(e){return"function"==typeof e}function y(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let x;function b(e,t){return x||(x=document.createElement("a")),x.href=t,e===x.href}const w="undefined"!=typeof window;let _=w?()=>window.performance.now():()=>Date.now(),M=w?e=>requestAnimationFrame(e):u;const E=new Set;function S(e){E.forEach((t=>{t.c(e)||(E.delete(t),t.f())})),0!==E.size&&M(S)}function A(e,t){e.appendChild(t)}function T(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function P(e){const t=I("style");return function(e,t){A(e.head||e,t)}(T(e),t),t.sheet}function L(e,t,n){e.insertBefore(t,n||null)}function C(e){e.parentNode.removeChild(e)}function I(e){return document.createElement(e)}function R(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O(e){return document.createTextNode(e)}function D(){return O(" ")}function N(){return O("")}function F(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function z(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function B(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function k(e,t,n,i){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}let H;function U(e,t){"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=I("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const i=function(){if(void 0===H){H=!1;try{"undefined"!=typeof window&&window.parent&&window.parent.document}catch(e){H=!0}}return H}();let r;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",r=F(window,"message",(e=>{e.source===n.contentWindow&&t()}))):(n.src="about:blank",n.onload=()=>{r=F(n.contentWindow,"resize",t)}),A(e,n),()=>{(i||r&&n.contentWindow)&&r(),C(n)}}function G(e,t,n){e.classList[n?"add":"remove"](t)}class j{constructor(){this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.e=I(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)L(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(C)}}const V=new Map;let W,q=0;function X(e,t,n,i,r,o,a,s=0){const l=16.666/i;let c="{\n";for(let v=0;v<=1;v+=l){const e=t+(n-t)*o(v);c+=100*v+`%{${a(e,1-e)}}\n`}const h=c+`100% {${a(n,1-n)}}\n}`,u=`__svelte_${function(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(h)}_${s}`,p=T(e),{stylesheet:d,rules:f}=V.get(p)||function(e,t){const n={stylesheet:P(t),rules:{}};return V.set(e,n),n}(p,e);f[u]||(f[u]=!0,d.insertRule(`@keyframes ${u} ${h}`,d.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?`${m}, `:""}${u} ${i}ms linear ${r}ms 1 both`,q+=1,u}function Y(e,t){const n=(e.style.animation||"").split(", "),i=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),r=n.length-i.length;r&&(e.style.animation=i.join(", "),q-=r,q||M((()=>{q||(V.forEach((e=>{const{stylesheet:t}=e;let n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.rules={}})),V.clear())})))}function Q(e){W=e}function Z(){if(!W)throw new Error("Function called outside component initialization");return W}function J(e){Z().$$.on_mount.push(e)}function K(e){Z().$$.on_destroy.push(e)}const $=[],ee=[],te=[],ne=[],ie=Promise.resolve();let re=!1;function oe(e){te.push(e)}const ae=new Set;let se,le=0;function ce(){const e=W;do{for(;le<$.length;){const e=$[le];le++,Q(e),he(e.$$)}for(Q(null),$.length=0,le=0;ee.length;)ee.pop()();for(let e=0;e<te.length;e+=1){const t=te[e];ae.has(t)||(ae.add(t),t())}te.length=0}while($.length);for(;ne.length;)ne.pop()();re=!1,ae.clear(),Q(e)}function he(e){if(null!==e.fragment){e.update(),v(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(oe)}}function ue(e,t,n){e.dispatchEvent(function(e,t,n=!1){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,!1,t),i}(`${t?"intro":"outro"}${n}`))}const pe=new Set;let de;function fe(){de={r:0,c:[],p:de}}function me(){de.r||v(de.c),de=de.p}function ve(e,t){e&&e.i&&(pe.delete(e),e.i(t))}function ge(e,t,n,i){if(e&&e.o){if(pe.has(e))return;pe.add(e),de.c.push((()=>{pe.delete(e),i&&(n&&e.d(1),i())})),e.o(t)}}const ye={duration:0};function xe(e,t,n){let i,r,o=t(e,n),a=!1,s=0;function l(){i&&Y(e,i)}function c(){const{delay:t=0,duration:n=300,easing:c=p,tick:h=u,css:d}=o||ye;d&&(i=X(e,0,1,n,t,c,d,s++)),h(0,1);const f=_()+t,m=f+n;r&&r.abort(),a=!0,oe((()=>ue(e,!0,"start"))),r=function(e){let t;return 0===E.size&&M(S),{promise:new Promise((n=>{E.add(t={c:e,f:n})})),abort(){E.delete(t)}}}((t=>{if(a){if(t>=m)return h(1,0),ue(e,!0,"end"),l(),a=!1;if(t>=f){const e=c((t-f)/n);h(e,1-e)}}return a}))}let h=!1;return{start(){h||(h=!0,Y(e),g(o)?(o=o(),(se||(se=Promise.resolve(),se.then((()=>{se=null}))),se).then(c)):c())},invalidate(){h=!1},end(){a&&(l(),a=!1)}}}function be(e,t){e.d(1),t.delete(e.key)}function we(e,t){ge(e,1,1,(()=>{t.delete(e.key)}))}function _e(e,t,n,i,r,o,a,s,l,c,h,u){let p=e.length,d=o.length,f=p;const m={};for(;f--;)m[e[f].key]=f;const v=[],g=new Map,y=new Map;for(f=d;f--;){const e=u(r,o,f),s=n(e);let l=a.get(s);l?i&&l.p(e,t):(l=c(s,e),l.c()),g.set(s,v[f]=l),s in m&&y.set(s,Math.abs(f-m[s]))}const x=new Set,b=new Set;function w(e){ve(e,1),e.m(s,h),a.set(e.key,e),h=e.first,d--}for(;p&&d;){const t=v[d-1],n=e[p-1],i=t.key,r=n.key;t===n?(h=t.first,p--,d--):g.has(r)?!a.has(i)||x.has(i)?w(t):b.has(r)?p--:y.get(i)>y.get(r)?(b.add(i),w(t)):(x.add(r),p--):(l(n,a),p--)}for(;p--;){const t=e[p];g.has(t.key)||l(t,a)}for(;d;)w(v[d-1]);return v}function Me(e,t){const n={},i={},r={$$scope:1};let o=e.length;for(;o--;){const a=e[o],s=t[o];if(s){for(const e in a)e in s||(i[e]=1);for(const e in s)r[e]||(n[e]=s[e],r[e]=1);e[o]=s}else for(const e in a)r[e]=1}for(const a in i)a in n||(n[a]=void 0);return n}function Ee(e){e&&e.c()}function Se(e,t,n,i){const{fragment:r,on_mount:o,on_destroy:a,after_update:s}=e.$$;r&&r.m(t,n),i||oe((()=>{const t=o.map(f).filter(g);a?a.push(...t):v(t),e.$$.on_mount=[]})),s.forEach(oe)}function Ae(e,t){const n=e.$$;null!==n.fragment&&(v(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Te(e,t){-1===e.$$.dirty[0]&&($.push(e),re||(re=!0,ie.then(ce)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Pe(e,t,n,i,r,o,a,s=[-1]){const l=W;Q(e);const c=e.$$={fragment:null,ctx:null,props:o,update:u,not_equal:r,bound:m(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:m(),dirty:s,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let h=!1;if(c.ctx=n?n(e,t.props||{},((t,n,...i)=>{const o=i.length?i[0]:n;return c.ctx&&r(c.ctx[t],c.ctx[t]=o)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](o),h&&Te(e,t)),n})):[],c.update(),h=!0,v(c.before_update),c.fragment=!!i&&i(c.ctx),t.target){if(t.hydrate){const e=(p=t.target,Array.from(p.childNodes));c.fragment&&c.fragment.l(e),e.forEach(C)}else c.fragment&&c.fragment.c();t.intro&&ve(e.$$.fragment),Se(e,t.target,t.anchor,t.customElement),ce()}var p;Q(l)}class Le{$destroy(){Ae(this,1),this.$destroy=u}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Ce(e){let t,n,i,r,o,a,s,l=e[0].name+"";return{c(){t=I("div"),n=I("span"),i=O(l),r=D(),o=I("div"),z(n,"class","room-label-item__text svelte-17nkflf"),k(n,"background-image","url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAA8CAYAAACZ1L+0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAYKADAAQAAAABAAAAPAAAAABU0H2EAAARRElEQVR4Ad2czY9cRZbFq1yFoQGDNCzwuAENohl54dkgdrNh34tZ8GciFi31nwEsmAEhhAWD1GMJCZgx5sMfUHN+J+NE3XfrZWWVcVVLHVLmuXG/74148V5m2bm/N8bR0dH+Bx988Po333zzbz///PONg4ODa+I9I9y/cuXKgV77h4eH+1KH3hP/yv7+vuBAsG+5UCIpCkMzDQ962Eu80Q1P/KmHT82v8IocZFL4pslDvL3fNARHoPI2wtbrV1jBIf9N8SEZ0UUP2wFHv2ocSc/2ouEz8PVooJXQ0/j10aNHoH2Idj4PHz4k1n29/k+5/u3ll1/+r7fffvtLzfGzd8ibjK6+9957f5ajf1XzH9y7d+8Xjf9FRs1SdvNBBg2SDQ1xh9ALH4yN0M2BNZrKwtFc9Fmkquuma5HJBzvLiIONBnx40B7QIzTdxCcNwj3dYlEoUmabAU+UFZDpxah22Ng2NjQXH0LrwccGwyEzXfWhWQwSYQHYuFevXj14/vnn37h79+7Nr7766gup/FX5PnAj33///f/46aef3vj444/vfPbZZz9IYGMcnDbkhEYQL001Hfsu775i+7j6LID6cDQWYo8mabGMxOr+e/ye3y7989p3/9jfvHnz2q1bt25oMb549913/3Lwzjvv/Mu3337775988smdzz///AcVQ+IecsAOp8OOHRpkiJniWQnrBJmwc7EF8atxBA2ihx/obf7Qqa+un+aDI0f7k08nU+PLj3PBR+qpcvFdd3BNP7YgI7mnHqHzBRndv1hH33///QNtlAcvvfTSq999992dQzFu/vjjj/c//fTTu1z+unT2wDFoHN13QbVg5CQS3tBfQGwHoo+chltPto4FMsR3nKCZ7a3KyDM+UOOyHzV4xxAHOTjGqfVcVv23b9++++abb/4TvT+8f//+dS3ALzqj3MxgMq6IjAUC4as4CrbdmLtA8S2vttA0D5vSxNBnOvLwK1vO4K3+FSY+Z/Ol71RiC8JI7iBzcrus+nWfvf/iiy/+86Eux2u6JO6RQBoTFCvFOGEKkcyFRZ+kt+kP/pRHF9xiD3uOrs8OFW9eoaFBxorcsfGDvOdTeJCRTxQruT/x+rXxH6nvzx1qRx+I4FHJQZxJeat8CqCY0vCarG+AnK86++whdDlzeQrZKieWhmCTC3GgEy+x01DiKHfuK6vxYhfcYj/zKWVPMrnAwE98RCG+mZPHafVVOX71hPRUHkOpnMe9+SSBQ5wpgJF5mlGTgp+R5oHwhj/7Za7kzQMZ8RPsBaZYEH3k6KbotfySQ/Tjg7lsXQ/IQFc5Chb5zgUR/8LqJyi99QJA0CySFc4znUTFm3d2Cq8FuYryFhk42HLh3bz1zI4N+qGLvXkJMXKcDer6yE+7IuInuObvMusn/iHNz4DBqoMM0W4gyJxmsgijqSfkyNALdv3YRl51oXfFP4u+fCjd43xTQ/wLtx5Zu+L3euI78VJXsOvX+hXrijbL3qEIP1lEObuKhENnR+IgvDU5vD7wGx4Fyn4ucHzFfy8I2/Dio2JkIPyu3+XEp2iQ0ePvqm+X3E7b27b64ZPHYRrCE0R/jq68kfB80mBOQhWhTxu9YHTTfOi+QGLZf7Dbd/3UAjK6PDwL9dafmi6zfm0Ob8xDVkIJs7O5ErxDQQaFhMdctHVB5o8xfLXJzo0dC1wfKxefK1b8L+xHHuGhHjobgzzDO+Fu1Dw/V6RWkHGR9avv5LW5CRNs7Aaf8Qq82mAZUNh8CkEPXvRDDz3cLob4zB0YAjvF3Wrf/fcdK3nyxt2k0WNoR/MlopG54i820Iq/RT3Y1DHqemL1cxX4JkxiXAkECBK4N6Ams0ZjCz+Y8xZkcCSEx3xXPOTJAf3kFv/dfkWOja9i7ImvMW/ChXbe3V9igxjuGskrmFrX6lcsP+FwBPn40WJAsihGgvWEkIe3JpetiwUZTz31lBsOMihE9NzxZpY3GoTtaNSk40/ooyXY84UfHm57fHjKH/DoDYotiEJqBZnDD29NTp74Bxk9fq8f3XwOIHM7z6rbw+bNwcc8tDG6YNGvpNxu/xwwZPOKobj4xEnobf536cvOVwDI6PrJLXl0uY3U94FA6CdSvxbKR5C3DcFJJFiCTrLvmJ4w9hr2g5Fo72aQgX7Fy9ZX7Bw/Z9rh5FrHk6yfJnGlH1+PilQbVOkkUXnQNDAIjV4wNhUjA3nFFqx05B2zuGClo9fj4xNe/IcG18Yu/S6vNUDjM7jmPzJwvPb5HCB6NoTLnoRjn0e41UuOhKTvRsagouSLpw49lXAu8ue6qjbpWuBkniScC2zyrPn253hkqs06Q3+Rb3IH1/yJd6H1c0XxFDSPIAVMM50QSdXRG4St5EmSQk2D1S70sE8MGriwj942PK//7mclXnJPvsntwuvX8cPfyTdfRSRRGqQifckO3lkSig4moV1Ab3iX94aOZ/bFB7ORk/2tPLfPZ/+R7wJoeGIg6PmkVjDy8Mxo9QzehO5PgvPUzx/19w71xqOhX3jm0akOjqfM04wR2OxKR28bsuLckEGGbH1EgAwVf64PZvgh/23+5JIdjuvVI7Q/JqJ4WfVrM/km7A9iKtw3tVHQbBDNogCQwWJoLjheFAvGW2QgrNGYc/09IDGwD5143f9afuJJfZNfaDD5YJMFgy9acCxnVxb5hdVPUNWz+RxAQF7sQKFvVKMBvoGpIKa+hNFJg80sb5GBg51mbBwUXUj8xIZ56GLvRUDGGDnOBj2G/vSxzd8l1/+P9/cAdn92dF8gFrAeWdLzgoBZkPCY46f6g85VuCbPxgx2/diCel1Rfnv+KgLFKCdpAoQG1wJikySRrw10wt+1g+MLxGaX/136tWD8Sf/EkRIfyNFPzcxDX0T9o9/H34YmYMXxVMKNEbaPIyVpNGPc3ESvHjFDZ0IvCEGKg+4LJFb8Grt915d8+tjiD/YcXT+5BC+yfi28Nyb/LKV+DpjJQZBgbbjoxWMdH6hGkrYLnQVbONtM+nP3QgX/YkRnIRuTyLwgK/qnynu+sl/s+B7wIuvXFeAa+JOkdw1NY+WTVE+GueQuEGQuGy8IyBxbaJB5H6MgirZIeosFHXbTXnqLfEaO9XPCqZ8DkmdwJd+5yUiox1vJ/4nXf66/B+xqAOcaSQfzSAcy1OBFwbsajjxNwT40OPwt5OJl8SxHpw42m8b83FDo6Y/cR14n4j3J+hWDmJvvglTQiS+3yJREakKhwTU5x5ps5ueG0CADu3Hi2R59mgIyQo9GmR8ecvKpuCsfdOsgTnKq/NA9P+IlBjqhQeZd3v0nFsjATkOw+YM8vMXfAyIEEVK8du/8ICVWjhZj35HY1NH9VRl0CglSUHwiDw0y7+NJ6/d8L7p+5X/y7wFJgmI5OrjscoTsagCNrPaiafLc4bI/1wLSYGIG1/yfdoX0BcxCBvsCdv8XWb9iubbN8+XoLAkRNAWLnfMwRwZ2bjIm0OiCw8Xc1ZlXjG30Y5t48MOrdqGzuCC87q/L9b2O6wHR7wsi/XnsISf2ZdVP7nrtLz6IKUHvWDAJJWnmocE1Obw6uj4yAkeH3SsdN2Hw3CjUorOCUxZbkBHfQfiiHQM5DRYvm+pEPefV7/6IUUdigeEnt8z974LE5PFqPmKJtgEJ5c6PAToN0bMdfOlPH8z76AmPONO+P6cTOzx8df/JDVyTm1neejyJEjt1LR6LL7h+paMv47QL544Sgx0yG60Es1vmCpZ6TjSEAtOkoXeiwFL0CXv95wg3HGTI1+I/TKw0fLFBbFTeej7UJ3Fqwn+uCltdZv3qu8Jrg+vMIyG/uFxF+7JNHfWSGQnOAtDVoMlWt8PNBzrPdzVsRX6uvwcQRDHn5uj+JE5u3mTopgZsyZuck/9l1q+4zm3+PYDEuCmRDJgEw2POYqBXF8WK4y0yMPxK54kFHCMfihyw2/d4XR4nwa6v3J0riE6P3+WpFWQonnsBMrp/M8vbWn7wolLji08vl1/GESBJxagizrKLKj90ZCC8+AKjU7H76/boklNsKEA686b9GPq2xcfa+DvU73uAk6I4VoTkQIZon+Egc/FphnnMV+TRCy7uCV0fHywCyOhHyC79jdXxO75kM4/I0GD866a+9dtd6pbupdSvWJu/BygxN1Tz2SwlcaYGVpvjNiwpdJac41m3J254aIU+xUc2w8xXZuHhIrTlaS7I6P53xd8lt9P2ti13jhrJlkdQlINJMj7rGTZ4+Zpi7uLoriF+dZmnKVapsXb5J2nsQYy7Puzw1uQOWN66fnIJolrp+AbHeOz645cHaBdFYfG6DTHKLkCHT40kAzJCJ8EuT/O2xdrlv9uzEOERP3T8n9cfPk4bu/ydp/7kmK+js3MWBfVk0nwQmQJ6QUDm8MNjzpnOIoCMQfvjPvNe0C7/StpPJSCDHRwec9m7DnDMrYhf5skt+ca2+Lv0+t0ZdhJDiczHIBKuvFGAi1YBTCctPc9pKEQQvmjrDb5peAzioQsOuenYd3nPB3l4a/bw6hh559GXDWEaRK/7i28QOfaQT6J+Umdj5LsgYs9iErDySIDGYJQGhc4OQ+e0sWK/2LEUJl+zwNAgg3wqkmdyDD885n3gBxfFn+nhluae6m8lf/dC/pxXj9fn1Z5aefFJ2I2twjjk6NBjm/+bz3BGQMgEzCPf5hJoEfETv03kKTKIgviNT0Shz+Q/seIPB3X0fLp+l190/Sw494Bc9v57LkkosAvmi7B8P1MLCS3bxXP3SkE+guQzJosFFN8NBqNQEf/Mg12fBuEbHONU/+Q3/AUXC07d8ncp9XPlkotvwiN5ijEz2BOCnyaXQsyLjxSZecXYFp3YptE0JrxqGjqyVf2V/KIX7Efo/PBHgNQdvMj66YGOoH3+WYqLKk1JsTtvkr1gzjSONJCBT1a6+q40eoo/9WWyeK6OL5Ax/Edn2uKDEd9BM8tbzxe98IraJJM7CBP98JjHFmR+3vqxOXzmmWceaKU337CxGhqCTUVolIGMabAnhGgUb71iahI7fFf7FIFCb3j/18voiuemdd/Mu/+uE1sQWfeX3MBuyzx5B39P/fRcr4dcAT9p5bxl4zhIgNqgnlRkILKuf1654tIUCk2oLJYbQpr0ZqRrGt30C1tk4FnyQYccray31B3s9UQviG104IUGmZ8mH5v+3qF2w51nn332TzHCsI7KJzEVm6akEVuPhLWGhUeM0CAjvkHmxCM+uCYPD2R0f2Ilt7lB4tMGZ3i7qPqfe+65P6j3X1y5du3aZ3rSefrGjRsvkNxpI80AeTGC0NgGoakvuFYrtvDjD11okBF6m3yjdfze9eM7sbPQIC8sg8detlPdP7XCy8ASOh6IC534Qf126Au6Aq7S+0P9jOJ/f/jhh7dfeeWVN1C4c+cOv5zoxsQgKD7O/OgIT3OLgrrkLAMR9EuQYsXLlWO5ePNMJ25s7Fhv8EIraduDDOJI7kfh6FT98M6Ka/GrLbE0/131X79+/YVXX331+tNPP32b3nt1tGhXP/rooz/ruf9N/YzWQ/2e2c8Cfg7Wz8RC9WkeE8pj/rQltMRH/jXdsdreAEp04mg8u22zYhvZ9IPueLE4puMLfnjRKzKCbD4ZHv9oK/mwaPOlm/ukkbFwjKLj428j8t8DEEvN9xJoJuhsDI9lxOeHXr3zE8cGm7fpQMfNgR54ntXmYXzx1ltvbX64VUl4SH//66+/fl2/5ndLC/BHMV/Q6ypN06Bm3lgFaKMcEbj+bDHN88/curvewF4hjhNWasrwhy/0waIPjylyYjp49Ag++NhFhi7F+jeEFcc/H6w5TYbnxo2OoufXmNPcX+XWv4QLMo+taJkfeY4gvtRs/n8vzY/cssxB5CyKxi96/aB+/Y9+KfE/X3vttS8lI7e9/wfu514OAjYP0QAAAABJRU5ErkJggg==)"),G(n,"wide",e[0].name.length>3),z(o,"class","room-label-item__bar svelte-17nkflf"),z(t,"class","room-label-item svelte-17nkflf"),k(t,"z-index",e[0].zIndex,!1),k(t,"transform",e[0].transform,!1),k(t,"opacity",e[0].visible?1:0,!1)},m(l,c){L(l,t,c),A(t,n),A(n,i),A(t,r),A(t,o),a||(s=F(n,"click",e[1]),a=!0)},p(e,[r]){1&r&&l!==(l=e[0].name+"")&&B(i,l),1&r&&G(n,"wide",e[0].name.length>3),1&r&&k(t,"z-index",e[0].zIndex,!1),1&r&&k(t,"transform",e[0].transform,!1),1&r&&k(t,"opacity",e[0].visible?1:0,!1)},i:u,o:u,d(e){e&&C(t),a=!1,s()}}}function Ie(e,t,n){let{five:i}=t,{roomLabel:r}=t;return e.$$set=e=>{"five"in e&&n(2,i=e.five),"roomLabel"in e&&n(0,r=e.roomLabel)},[r,function(){i.setState({panoIndex:r.panoIndex,mode:"Panorama",longitude:r.longitude})},i]}class Re extends Le{constructor(e){super(),Pe(this,e,Ie,Ce,y,{five:2,roomLabel:0})}}function Oe(e,t,n){const i=e.slice();return i[9]=t[n],i}function De(e,t){let n,i,r;return i=new Re({props:{roomLabel:t[9],five:t[1]}}),{key:e,first:null,c(){n=N(),Ee(i.$$.fragment),this.first=n},m(e,t){L(e,n,t),Se(i,e,t),r=!0},p(e,n){t=e;const r={};1&n&&(r.roomLabel=t[9]),2&n&&(r.five=t[1]),i.$set(r)},i(e){r||(ve(i.$$.fragment,e),r=!0)},o(e){ge(i.$$.fragment,e),r=!1},d(e){e&&C(n),Ae(i,e)}}}function Ne(e){let t,n,i,r=[],o=new Map,a=e[0];const s=e=>e[9].id;for(let l=0;l<a.length;l+=1){let t=Oe(e,a,l),n=s(t);o.set(n,r[l]=De(n,t))}return{c(){t=I("div");for(let e=0;e<r.length;e+=1)r[e].c();z(t,"class","room-labels-container svelte-185yvaa"),oe((()=>e[4].call(t)))},m(o,a){L(o,t,a);for(let e=0;e<r.length;e+=1)r[e].m(t,null);n=U(t,e[4].bind(t)),i=!0},p(e,[n]){3&n&&(a=e[0],fe(),r=_e(r,n,s,1,e,a,o,t,we,De,null,Oe),me())},i(e){if(!i){for(let e=0;e<a.length;e+=1)ve(r[e]);i=!0}},o(e){for(let t=0;t<r.length;t+=1)ge(r[t]);i=!1},d(e){e&&C(t);for(let t=0;t<r.length;t+=1)r[t].d();n()}}}function Fe(e,n,i){let r,o,{five:a}=n,{roomLabels:s}=n;function l(e,n){const i=n.map((n=>{const i=function(e,n){if(null!==e.model.shownFloor&&n.floorIndex!==e.model.shownFloor)return!1;const i=new t.Raycaster,r=e.camera.position.clone(),o=new t.Vector3(n.position.x,n.position.y,n.position.z),a=o.distanceTo(r);i.set(r.clone(),o.clone().sub(r).normalize());const[s]=e.model.intersectRaycaster(i);return!(s&&s.distance+1<a)}(e,n);if(!i)return __spreadProps(__spreadValues({},n),{visible:i});const a=function(e,n){const i=new t.Vector3(n.position.x,n.position.y,n.position.z).clone().project(e.camera);return`translate(${Math.ceil((i.x+1)/2*r)}px, ${Math.ceil((1-i.y)/2*o)}px)`}(e,n);return __spreadProps(__spreadValues({},n),{visible:i,transform:a})})),a=i.filter((({visible:e})=>e)).map((n=>({roomLabelItem:n,distance:new t.Vector3(...Object.values(n.position)).clone().distanceTo(e.camera.position)}))).sort(((e,t)=>e.distance-t.distance));return i.map((e=>{const t=a.findIndex((t=>t.roomLabelItem.id===e.id));return void 0!==t?__spreadProps(__spreadValues({},e),{zIndex:10*t}):e}))}function c(){i(0,s=l(a,s))}return a.on("cameraDirectionUpdate",c),K((()=>{a.off("cameraDirectionUpdate",c)})),J((()=>{c()})),e.$$set=e=>{"five"in e&&i(1,a=e.five),"roomLabels"in e&&i(0,s=e.roomLabels)},[s,a,r,o,function(){r=this.clientWidth,o=this.clientHeight,i(2,r),i(3,o)}]}class ze extends Le{constructor(e){super(),Pe(this,e,Fe,Ne,y,{five:1,roomLabels:0})}}class Be{constructor(e){__publicField(this,"five"),__publicField(this,"enabled",!0),__publicField(this,"fiveModeEnabled"),__publicField(this,"app"),__publicField(this,"wrapper"),__publicField(this,"roomLabels",[]),__publicField(this,"container",document.createElement("div")),__publicField(this,"onFiveModeChange",(e=>{if("Floorplan"!==e)return this.fiveModeEnabled=!1,void this.render();this.five.once("initAnimationEnded",(()=>{this.fiveModeEnabled="Floorplan"===this.five.currentMode,this.render()}))})),this.five=e,this.fiveModeEnabled="Floorplan"===this.five.currentMode,this.container.classList.add("model-room-label-plugin-container"),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="absolute",this.container.style.pointerEvents="none",this.container.style.left="0",this.container.style.top="0",this.five.once("dispose",(()=>this.dispose())),this.five.on("modeChange",this.onFiveModeChange),this.render()}dispose(){this.five.off("modeChange",this.onFiveModeChange),this.container.remove()}load(e){this.roomLabels=function(e){return e.model_room_labels.map((({id:e,pano_index:t,floor_index:n,name:i,position:r,longitude:o})=>({id:e,name:i,position:r,longitude:o,panoIndex:t,floorIndex:n,zIndex:0,visible:!1,transform:""})))}(e),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this.render(),this}disable(){return this.enabled=!1,this.render(),this}enable(){return this.enabled=!0,this.render(),this}render(){var e;if(this.wrapper)return this.enable&&this.fiveModeEnabled?void(this.app?this.app.$set({five:this.five,roomLabels:this.roomLabels}):this.app=new ze({target:this.container,props:{five:this.five,roomLabels:this.roomLabels}})):(null==(e=this.app)||e.$destroy(),void(this.app=void 0))}}var ke=(e=>(e[e.FLOOR=1]="FLOOR",e[e.CEILING=2]="CEILING",e[e.BOUNDING_CENTER=3]="BOUNDING_CENTER",e))(ke||{});const He={position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"10"};function Ue(e,t={}){let n="";const{needZ:i,needA:r}=t;return(i?e.slice().concat(e[0]):e.slice()).forEach(((e,i)=>{const{x:o,y:a}=t.format?t.format(e):e,s=o+","+a;return 0===i?(n+="M"+s,n):(null==r?void 0:r[i])?(n+="A"+r[i]+","+s,n):(n+="L"+s,n)})),n+(i?"Z":"")}function Ge({x:e,y:t},n,i){const{max:r,min:o}=i;return{x:(e-o.x)*n,y:(r.y-t)*n}}function je(e){return{id:e.id,size:e.size,name:e.name,path:e.path,roomType:e.room_type,floorType:e.floor_type,roomLabel:{position:e.room_label.position,positionInImage:e.room_label.position_in_image},observerIndexs:e.observer_indexs}}function Ve(e){return{floorName:e.floor_name,floorIndex:e.floor_index,rooms:e.rooms.map(je),rules:e.rules}}function We(e){return{index:e.index,floorIndex:e.floor_index,position:e.position,positionInImage:e.position_in_image}}async function qe(e){const t=await async function(e){const t=new Headers({"Content-Type":"text/plain"});return await Promise.all(e.map((async function(e){const n={index:e.index,url:e.url,svgUrl:e.svg_url};if(e.svg_url){const i=await fetch(e.svg_url,{headers:t}).then((e=>e.text()));n.svgContent=i}return n})))}(e.outlines),n=e.computed_data.bounding,i=e.computed_data.floor_datas.map(Ve),r=e.computed_data.entrance?function(e){return{rad:e.rad,position:e.position,positionInImage:e.position_in_image,northRad:e.north_rad,roomId:e.room_id,floorIndex:e.floor_index}}(e.computed_data.entrance):null;return{outlines:t,entrance:r,bounding:n,floorDatas:i,observers:e.computed_data.observers.map(We)}}function Xe(e,t,n){const i=e.map((e=>{const i=e.position,r=e.icon?e.icon:{url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC",width:45,height:48},o=function(e,t){return Math.max(...t.work.observers.map((t=>e.z>=t.standingPosition.z?t.floorIndex:0)))}(i,t),a=function(e,t){return{x:1e3*e.x+t.bounding.origin.x,y:1e3*-e.z+t.bounding.origin.y}}(i,n),s=function(e,t){const n=t.bounding,i=n.max.x-n.min.x,r=n.max.y-n.min.y;return{x:(e.x-n.min.x)/i,y:(n.max.y-e.y)/r}}(a,n);return{floorIndex:o,icon:r,id:e.id,position:a,positionInImage:s}}));return i}function Ye(e,t){return(n=>{for(const i in e)-1===t.indexOf(i)&&(n[i]=e[i])})(n={}),n;var n}function Qe(e,t,n,i){const r=Math.max(...e.work.observers.map((e=>e.floorIndex)));function o(t){return t>r?e.model.bounding.max.y:Math.max(...e.work.observers.filter((e=>e.floorIndex===t)).map((e=>e.standingPosition.y)))}const s=function(){const t=o(n),r=o(n+1),a=(null==i?void 0:i.attachedTo)||ke.BOUNDING_CENTER;return a===ke.BOUNDING_CENTER?(e.model.bounding.max.y+e.model.bounding.min.y)/2:a===ke.CEILING?r:t}(),l=new a.Vector3(0,s,0),c=new a.Vector3(1,s,0),h=l.clone().project(e.camera),u=c.clone().project(e.camera);return Math.abs((u.x-h.x)/1e3)*(t.getBoundingClientRect().width/2)}const Ze="data:image/png;base64,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";function Je(e){let t,n;return{c(){t=I("div"),n=I("div"),z(n,"class","floorplan__camera-rotate svelte-e8a2kn"),k(n,"background-image",`url(${e[0]||Ze})`),k(n,"width",e[4],!1),k(n,"height",e[4],!1),k(n,"left","-"+e[4],!1),k(n,"top","-"+e[4],!1),k(n,"transform",`rotate(${e[3]}deg)`,!1),k(n,"transform-origin",`${e[4]} ${e[4]}`,!1),z(t,"class","floorplan__camera-position svelte-e8a2kn"),k(t,"left",e[1],!1),k(t,"top",e[2],!1)},m(e,i){L(e,t,i),A(t,n)},p(e,[t]){1&t&&k(n,"background-image",`url(${e[0]||Ze})`)},i:u,o:u,d(e){e&&C(t)}}}function Ke(e,t,n){let{panoIndex:i}=t,{floorplanData:r}=t,{lastPanoramaLongitude:o}=t,{cameraImageUrl:a}=t;const{observers:s}=r,l=s[i],c=100*l.positionInImage.x+"%",h=100*l.positionInImage.y+"%",u=-180*o/Math.PI+45;const p=document.body.clientWidth,d=document.body.clientHeight,f=(p<500||d<500?17:37)/16+"rem";return e.$$set=e=>{"panoIndex"in e&&n(5,i=e.panoIndex),"floorplanData"in e&&n(6,r=e.floorplanData),"lastPanoramaLongitude"in e&&n(7,o=e.lastPanoramaLongitude),"cameraImageUrl"in e&&n(0,a=e.cameraImageUrl)},[a,c,h,u,f,i,r,o]}class $e extends Le{constructor(e){super(),Pe(this,e,Ke,Je,y,{panoIndex:5,floorplanData:6,lastPanoramaLongitude:7,cameraImageUrl:0})}}function et(e){let t,n=e[0]&&function(e){let t,n,i,r;return{c(){t=I("div"),n=I("div"),i=D(),r=I("span"),r.textContent="北",z(n,"class","floorplan-plugin__compass-image svelte-5l80pv"),k(n,"background-image","url(data:image/png;base64,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)"),z(r,"class","floorplan-plugin__compass-text svelte-5l80pv"),z(t,"class","floorplan-plugin__compass svelte-5l80pv"),k(t,"transform",e[1],!1)},m(e,o){L(e,t,o),A(t,n),A(t,i),A(t,r)},p:u,d(e){e&&C(t)}}}(e);return{c(){n&&n.c(),t=N()},m(e,i){n&&n.m(e,i),L(e,t,i)},p(e,[t]){e[0]&&n.p(e,t)},i:u,o:u,d(e){n&&n.d(e),e&&C(t)}}}function tt(e,t,n){var i;let{floorplanData:r}=t;const o=null==(i=r.entrance)?void 0:i.northRad;const a=`translateX(-50%) translateZ(10px) rotate(${90-(o?o/Math.PI*180:0)}deg)`;return e.$$set=e=>{"floorplanData"in e&&n(2,r=e.floorplanData)},[o,a,r]}class nt extends Le{constructor(e){super(),Pe(this,e,tt,et,y,{floorplanData:2})}}function it(e,{delay:t=0,duration:n=400,easing:i=p}={}){const r=+getComputedStyle(e).opacity;return{delay:t,duration:n,easing:i,css:e=>"opacity: "+e*r}}function rt(e){let t,n,i=e[2].outerHTML+"";return{c(){t=new j,n=N(),t.a=n},m(e,r){t.m(i,e,r),L(e,n,r)},p(e,n){4&n&&i!==(i=e[2].outerHTML+"")&&t.p(i)},d(e){e&&C(n),e&&t.d()}}}function ot(e){let t,n,i,r,o=e[0].name+"";return{c(){t=I("span"),n=O(o),i=D(),r=I("span"),r.textContent=`${e[3]}`,z(t,"class","floorplan-plugin__room-name"),z(r,"class","floorplan-plugin__room-size svelte-1ashbdx")},m(e,o){L(e,t,o),A(t,n),L(e,i,o),L(e,r,o)},p(e,t){1&t&&o!==(o=e[0].name+"")&&B(n,o)},d(e){e&&C(t),e&&C(i),e&&C(r)}}}function at(e){let t;function n(e,t){return void 0===e[1]?ot:e[2]?rt:void 0}let i=n(e),r=i&&i(e);return{c(){t=I("div"),r&&r.c(),z(t,"class","floorplan-plugin__room-label-item svelte-1ashbdx"),k(t,"left",e[4],!1),k(t,"top",e[5],!1),k(t,"font-size",e[6],!1)},m(e,n){L(e,t,n),r&&r.m(t,null)},p(e,[o]){i===(i=n(e))&&r?r.p(e,o):(r&&r.d(1),r=i&&i(e),r&&(r.c(),r.m(t,null)))},i:u,o:u,d(e){e&&C(t),r&&r.d()}}}function st(e,t,n){let i,{room:r}=t,{getLabelElement:o}=t;const a=document.body.clientWidth,s=document.body.clientHeight,l=r.size?(r.size/1e6).toFixed(1)+"㎡":"",c=r.roomLabel,h=100*c.positionInImage.x+"%",u=100*c.positionInImage.y+"%",p=(a<500||s<500?10:14)/16+"rem";return e.$$set=e=>{"room"in e&&n(0,r=e.room),"getLabelElement"in e&&n(1,o=e.getLabelElement)},e.$$.update=()=>{3&e.$$.dirty&&n(2,i=null==o?void 0:o(r))},[r,o,i,l,h,u,p]}class lt extends Le{constructor(e){super(),Pe(this,e,st,at,y,{room:0,getLabelElement:1})}}function ct(e,t,n){const i=e.slice();return i[4]=t[n],i}function ht(e){let t,n,i=[],r=new Map,o=e[1];const a=e=>e[4].id;for(let s=0;s<o.length;s+=1){let t=ct(e,o,s),n=a(t);r.set(n,i[s]=ut(n,t))}return{c(){t=I("div");for(let e=0;e<i.length;e+=1)i[e].c();z(t,"class","floorplan-plugin__room-labels svelte-sw25w3")},m(e,r){L(e,t,r);for(let n=0;n<i.length;n+=1)i[n].m(t,null);n=!0},p(e,n){3&n&&(o=e[1],fe(),i=_e(i,n,a,1,e,o,r,t,we,ut,null,ct),me())},i(e){if(!n){for(let e=0;e<o.length;e+=1)ve(i[e]);n=!0}},o(e){for(let t=0;t<i.length;t+=1)ge(i[t]);n=!1},d(e){e&&C(t);for(let t=0;t<i.length;t+=1)i[t].d()}}}function ut(e,t){let n,i,r;const o=[{room:t[4],getLabelElement:t[0]}];let a={};for(let s=0;s<o.length;s+=1)a=d(a,o[s]);return i=new lt({props:a}),{key:e,first:null,c(){n=N(),Ee(i.$$.fragment),this.first=n},m(e,t){L(e,n,t),Se(i,e,t),r=!0},p(e,n){t=e;const r=3&n?Me(o,[{room:t[4],getLabelElement:t[0]}]):{};i.$set(r)},i(e){r||(ve(i.$$.fragment,e),r=!0)},o(e){ge(i.$$.fragment,e),r=!1},d(e){e&&C(n),Ae(i,e)}}}function pt(e){let t,n,i=e[1]&&ht(e);return{c(){i&&i.c(),t=N()},m(e,r){i&&i.m(e,r),L(e,t,r),n=!0},p(e,[n]){e[1]?i?(i.p(e,n),2&n&&ve(i,1)):(i=ht(e),i.c(),ve(i,1),i.m(t.parentNode,t)):i&&(fe(),ge(i,1,1,(()=>{i=null})),me())},i(e){n||(ve(i),n=!0)},o(e){ge(i),n=!1},d(e){i&&i.d(e),e&&C(t)}}}function dt(e,t,n){let i,{floorIndex:r}=t,{floorplanData:o}=t,{getLabelElement:a}=t;return e.$$set=e=>{"floorIndex"in e&&n(2,r=e.floorIndex),"floorplanData"in e&&n(3,o=e.floorplanData),"getLabelElement"in e&&n(0,a=e.getLabelElement)},e.$$.update=()=>{12&e.$$.dirty&&n(1,i=o.floorDatas[r].rooms)},[a,i,r,o]}class ft extends Le{constructor(e){super(),Pe(this,e,dt,pt,y,{floorIndex:2,floorplanData:3,getLabelElement:0})}}function mt(e){return null!=e}function vt(e,t,n){const i=e.slice();return i[24]=t[n],i[26]=n,i}function gt(e,t,n){const i=e.slice();return i[27]=t[n],i[29]=n,i}function yt(e,t){let n,i=`${t[27]}px`;return{key:e,first:null,c(){n=I("div"),z(n,"class","floorplan-plugin__rule-scale svelte-1rr09in"),k(n,"left",i,!1),this.first=n},m(e,t){L(e,n,t)},p(e,n){t=e},d(e){e&&C(n)}}}function xt(e,t){let n,i,r,o,a=t[24].distance+"",s=`${t[24].positionPx}px`;return{key:e,first:null,c(){n=I("div"),i=I("span"),r=O(a),o=D(),z(i,"class","floorplan-plugin__rule-text svelte-1rr09in"),G(i,"is-row",t[5]),z(n,"class","floorplan-plugin__text-wrapper svelte-1rr09in"),G(n,"floorplan-plugin__text-wrapper--is-left-or-top",t[3]||t[1]),G(n,"floorplan-plugin__text-wrapper-is-right-or-bottom",t[4]||t[2]),k(n,"left",s,!1),this.first=n},m(e,t){L(e,n,t),A(n,i),A(i,r),A(n,o)},p(e,n){t=e},d(e){e&&C(n)}}}function bt(e){let t,n,i,r,o,a=[],s=new Map,l=[],c=new Map,h=e[6];const p=e=>e[29];for(let u=0;u<h.length;u+=1){let t=gt(e,h,u),n=p(t);s.set(n,a[u]=yt(n,t))}let d=e[10];const f=e=>e[26];for(let u=0;u<d.length;u+=1){let t=vt(e,d,u),n=f(t);c.set(n,l[u]=xt(n,t))}return{c(){t=I("div"),n=I("div"),i=D();for(let e=0;e<a.length;e+=1)a[e].c();r=D();for(let e=0;e<l.length;e+=1)l[e].c();z(n,"class","floorplan-plugin__rule-line svelte-1rr09in"),z(t,"class",o="floorplan-plugin__rule-labels floorplan-plugin__rule-labels-"+e[0]+" svelte-1rr09in"),k(t,"width",e[9],!1),k(t,"transform",e[7],!1),k(t,"transform-origin",e[8],!1)},m(e,o){L(e,t,o),A(t,n),A(t,i);for(let n=0;n<a.length;n+=1)a[n].m(t,null);A(t,r);for(let n=0;n<l.length;n+=1)l[n].m(t,null)},p(e,[n]){64&n&&(h=e[6],a=_e(a,n,p,1,e,h,s,t,be,yt,r,gt)),1086&n&&(d=e[10],l=_e(l,n,f,1,e,d,c,t,be,xt,null,vt)),1&n&&o!==(o="floorplan-plugin__rule-labels floorplan-plugin__rule-labels-"+e[0]+" svelte-1rr09in")&&z(t,"class",o)},i:u,o:u,d(e){e&&C(t);for(let t=0;t<a.length;t+=1)a[t].d();for(let t=0;t<l.length;t+=1)l[t].d()}}}function wt(e,t,n){let{pxmm:i}=t,{type:r}=t,{data:o}=t,{bounding:a}=t;const s="top"===r,l="bottom"===r,c="left"===r,h="right"===r,u=s||l,p=o.map((([e,t])=>u?[e.x,t.x]:[e.y,t.y])).flat().sort().filter(((e,t,n)=>0===t||e!==n[t-1])),d=p[0],f=p.slice(-1)[0]-d,m=u?a.min.x:a.min.y,v=f*i,g=p.map((e=>(e-d)/f*v)),y=(d-m)*i,x=27-1e3*i,b=`${s?`translate(${y}px, ${-x}px)`:l?`translate(${y}px, ${x}px)`:c?`translate(${-x}px, ${-y}px)`:h?`translate(${x}px, ${-y-v}px)`:void 0} ${u?"rotate(0)":"rotate(-90deg)"}`,w=`${h?"right":"left"} ${s?"top":"bottom"}`,_=v+"px",M=p.map(((e,t,n)=>{if(0===t)return null;const i=e-n[t-1];return{distance:i,positionPx:(n[t-1]+i/2-d)/f*v}})).filter(mt).filter((e=>e.distance/f>.12));return e.$$set=e=>{"pxmm"in e&&n(11,i=e.pxmm),"type"in e&&n(0,r=e.type),"data"in e&&n(12,o=e.data),"bounding"in e&&n(13,a=e.bounding)},[r,s,l,c,h,u,g,b,w,_,M,i,o,a]}class _t extends Le{constructor(e){super(),Pe(this,e,wt,bt,y,{pxmm:11,type:0,data:12,bounding:13})}}function Mt(e,t,n){const i=e.slice();return i[7]=t[n][0],i[8]=t[n][1],i}function Et(e,t){let n,i,r;const o=[{type:t[7],data:t[8],pxmm:t[0],bounding:t[2]}];let a={};for(let s=0;s<o.length;s+=1)a=d(a,o[s]);return i=new _t({props:a}),{key:e,first:null,c(){n=N(),Ee(i.$$.fragment),this.first=n},m(e,t){L(e,n,t),Se(i,e,t),r=!0},p(e,n){t=e;const r=7&n?Me(o,[{type:t[7],data:t[8],pxmm:t[0],bounding:t[2]}]):{};i.$set(r)},i(e){r||(ve(i.$$.fragment,e),r=!0)},o(e){ge(i.$$.fragment,e),r=!1},d(e){e&&C(n),Ae(i,e)}}}function St(e){let t,n,i=[],r=new Map,o=e[1];const a=e=>e[7];for(let s=0;s<o.length;s+=1){let t=Mt(e,o,s),n=a(t);r.set(n,i[s]=Et(n,t))}return{c(){t=I("div");for(let e=0;e<i.length;e+=1)i[e].c();z(t,"class","floorplan-plugin__rulelabels")},m(e,r){L(e,t,r);for(let n=0;n<i.length;n+=1)i[n].m(t,null);n=!0},p(e,[n]){7&n&&(o=e[1],fe(),i=_e(i,n,a,1,e,o,r,t,we,Et,null,Mt),me())},i(e){if(!n){for(let e=0;e<o.length;e+=1)ve(i[e]);n=!0}},o(e){for(let t=0;t<i.length;t+=1)ge(i[t]);n=!1},d(e){e&&C(t);for(let t=0;t<i.length;t+=1)i[t].d()}}}function At(e,t,n){let i,r,o,a,{pxmm:s}=t,{floorIndex:l}=t,{floorplanData:c}=t;return e.$$set=e=>{"pxmm"in e&&n(0,s=e.pxmm),"floorIndex"in e&&n(3,l=e.floorIndex),"floorplanData"in e&&n(4,c=e.floorplanData)},e.$$.update=()=>{16&e.$$.dirty&&n(2,i=c.bounding),24&e.$$.dirty&&n(5,r=c.floorDatas[l].rules),32&e.$$.dirty&&n(6,o=Object.keys(r)),96&e.$$.dirty&&n(1,a=o.map((e=>[e,r[e]])))},[s,a,i,l,c,r,o]}class Tt extends Le{constructor(e){super(),Pe(this,e,At,St,y,{pxmm:0,floorIndex:3,floorplanData:4})}}function Pt(e){let t,n;return{c(){t=I("img"),b(t.src,n=e[0])||z(t,"src",n),z(t,"alt","floorplan iamge"),z(t,"class","svelte-1cuuebb")},m(e,n){L(e,t,n)},p(e,[i]){1&i&&!b(t.src,n=e[0])&&z(t,"src",n)},i:u,o:u,d(e){e&&C(t)}}}function Lt(e,t,n){let{url:i}=t;return e.$$set=e=>{"url"in e&&n(0,i=e.url)},[i]}class Ct extends Le{constructor(e){super(),Pe(this,e,Lt,Pt,y,{url:0})}}function It(e){let t,n,i,r;return{c(){t=I("div"),n=new j,i=D(),r=new j,n.a=i,r.a=null,z(t,"class","floorplan-plugin__base-image svelte-1qqy56u")},m(o,a){L(o,t,a),n.m(e[1],t),A(t,i),r.m(e[0],t)},p(e,[t]){1&t&&r.p(e[0])},i:u,o:u,d(e){e&&C(t)}}}function Rt(e,t,n){let{content:i}=t;return e.$$set=e=>{"content"in e&&n(0,i=e.content)},[i,"\n <style>\n svg [type='lineGroup'] path {\n fill: #ffffff;\n stroke: #ffffff;\n }\n svg [type='lineItemGroup'] g g g g {\n stroke: #ffffff;\n }\n </style>\n "]}class Ot extends Le{constructor(e){super(),Pe(this,e,Rt,It,y,{content:0})}}function Dt(e){let t,n;return t=new Ct({props:{url:e[1].url}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.url=e[1].url),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Nt(e){let t,n;return t=new Ot({props:{content:e[0]}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.content=e[0]),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Ft(e){let t,n,i,r;const o=[Nt,Dt],a=[];function s(e,t){return e[0]?0:e[1]?1:-1}return~(n=s(e))&&(i=a[n]=o[n](e)),{c(){t=I("div"),i&&i.c(),z(t,"class","floorplan-plugin__base-image svelte-126ja8e")},m(e,i){L(e,t,i),~n&&a[n].m(t,null),r=!0},p(e,[r]){let l=n;n=s(e),n===l?~n&&a[n].p(e,r):(i&&(fe(),ge(a[l],1,1,(()=>{a[l]=null})),me()),~n?(i=a[n],i?i.p(e,r):(i=a[n]=o[n](e),i.c()),ve(i,1),i.m(t,null)):i=null)},i(e){r||(ve(i),r=!0)},o(e){ge(i),r=!1},d(e){e&&C(t),~n&&a[n].d()}}}function zt(e,t,n){let i,r,{floorIndex:o}=t,{floorplanData:a}=t;return e.$$set=e=>{"floorIndex"in e&&n(2,o=e.floorIndex),"floorplanData"in e&&n(3,a=e.floorplanData)},e.$$.update=()=>{var t,s;12&e.$$.dirty&&n(1,i=a.outlines[o]),12&e.$$.dirty&&n(0,r=null==(s=null==(t=a.outlines)?void 0:t[o])?void 0:s.svgContent)},[r,i,o,a]}class Bt extends Le{constructor(e){super(),Pe(this,e,zt,Ft,y,{floorIndex:2,floorplanData:3})}}function kt(e){let t;return{c(){t=R("path"),z(t,"d",e[0]),z(t,"fill","#2F313A")},m(e,n){L(e,t,n)},p(e,[n]){1&n&&z(t,"d",e[0])},i:u,o:u,d(e){e&&C(t)}}}function Ht(e,t,n){let i,{path:r}=t;return e.$$set=e=>{"path"in e&&n(1,r=e.path)},e.$$.update=()=>{2&e.$$.dirty&&n(0,i=Ue(r,{needZ:!0}))},[i,r]}class Ut extends Le{constructor(e){super(),Pe(this,e,Ht,kt,y,{path:1})}}function Gt(e){let t,n,i,r,o,a;return{c(){t=R("defs"),n=R("pattern"),i=R("rect"),r=R("path"),o=D(),a=R("path"),z(i,"x","0"),z(i,"y","0"),z(i,"width",e[1]),z(i,"height",e[1]),z(i,"fill","#323747"),z(r,"d",e[2]),z(r,"stroke","#ffffff"),z(r,"stroke-opacity","0.06"),z(r,"stroke-width","0.5"),z(r,"fill","none"),z(n,"id","fpm-room-pattern-0"),z(n,"x","0"),z(n,"y","0"),z(n,"width",e[1]),z(n,"height",e[1]),z(n,"patternUnits","userSpaceOnUse"),z(a,"d",e[0]),z(a,"fill","url(#fpm-room-pattern-0)")},m(e,s){L(e,t,s),A(t,n),A(n,i),A(n,r),L(e,o,s),L(e,a,s)},p(e,[t]){1&t&&z(a,"d",e[0])},i:u,o:u,d(e){e&&C(t),e&&C(o),e&&C(a)}}}function jt(e,t,n){let i,{path:r}=t;return e.$$set=e=>{"path"in e&&n(3,r=e.path)},e.$$.update=()=>{8&e.$$.dirty&&n(0,i=Ue(r,{needZ:!0}))},[i,12,"M0 6 h 12 M6 0 v 12",r]}class Vt extends Le{constructor(e){super(),Pe(this,e,jt,Gt,y,{path:3})}}function Wt(e){let t,n,i,r,o,a,s,l,c,h,p;return{c(){t=R("defs"),n=R("pattern"),i=R("rect"),r=R("pattern"),o=R("rect"),a=D(),s=R("path"),l=D(),c=R("path"),h=D(),p=R("path"),z(i,"x","0.5"),z(i,"y","0.5"),z(i,"width","6"),z(i,"height","50"),z(i,"fill","none"),z(i,"stroke","#4B4B57"),z(i,"stroke-width","0.5"),z(n,"id","room-material-pattern-1"),z(n,"x","0"),z(n,"y","0"),z(n,"width","13"),z(n,"height","51"),z(n,"patternUnits","userSpaceOnUse"),z(o,"x","0.5"),z(o,"y","0.5"),z(o,"width","6"),z(o,"height","50"),z(o,"fill","none"),z(o,"stroke","#4B4B57"),z(o,"stroke-width","0.5"),z(r,"id","room-material-pattern-2"),z(r,"x","7"),z(r,"y","25"),z(r,"width","13"),z(r,"height","51"),z(r,"patternUnits","userSpaceOnUse"),z(s,"d",e[0]),z(s,"fill","#43434D"),z(c,"d",e[0]),z(c,"fill","url(#room-material-pattern-1)"),z(p,"d",e[0]),z(p,"fill","url(#room-material-pattern-2)")},m(e,u){L(e,t,u),A(t,n),A(n,i),A(t,r),A(r,o),L(e,a,u),L(e,s,u),L(e,l,u),L(e,c,u),L(e,h,u),L(e,p,u)},p(e,[t]){1&t&&z(s,"d",e[0]),1&t&&z(c,"d",e[0]),1&t&&z(p,"d",e[0])},i:u,o:u,d(e){e&&C(t),e&&C(a),e&&C(s),e&&C(l),e&&C(c),e&&C(h),e&&C(p)}}}function qt(e,t,n){let i,{path:r}=t;return e.$$set=e=>{"path"in e&&n(1,r=e.path)},e.$$.update=()=>{2&e.$$.dirty&&n(0,i=Ue(r,{needZ:!0}))},[i,r]}class Xt extends Le{constructor(e){super(),Pe(this,e,qt,Wt,y,{path:1})}}function Yt(e,t,n){const i=e.slice();return i[4]=t[n],i}function Qt(e){let t,n;return t=new Vt({props:{path:e[4].path}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.path=e[4].path),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Zt(e){let t,n;return t=new Xt({props:{path:e[4].path}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.path=e[4].path),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Jt(e){let t,n;return t=new Ut({props:{path:e[4].path}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.path=e[4].path),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Kt(e){let t,n,i,r;const o=[Jt,Zt,Qt],a=[];function s(e,t){return 1===e[4].floorType?0:0===e[4].floorType?1:2}return n=s(e),i=a[n]=o[n](e),{c(){t=R("svg"),i.c(),z(t,"class","svelte-1b0icjc")},m(e,i){L(e,t,i),a[n].m(t,null),r=!0},p(e,r){let l=n;n=s(e),n===l?a[n].p(e,r):(fe(),ge(a[l],1,1,(()=>{a[l]=null})),me(),i=a[n],i?i.p(e,r):(i=a[n]=o[n](e),i.c()),ve(i,1),i.m(t,null))},i(e){r||(ve(i),r=!0)},o(e){ge(i),r=!1},d(e){e&&C(t),a[n].d()}}}function $t(e){let t,n,i=e[0],r=[];for(let a=0;a<i.length;a+=1)r[a]=Kt(Yt(e,i,a));const o=e=>ge(r[e],1,1,(()=>{r[e]=null}));return{c(){t=I("div");for(let e=0;e<r.length;e+=1)r[e].c();z(t,"class","floorplan-plugin__room-material")},m(e,i){L(e,t,i);for(let n=0;n<r.length;n+=1)r[n].m(t,null);n=!0},p(e,[n]){if(1&n){let a;for(i=e[0],a=0;a<i.length;a+=1){const o=Yt(e,i,a);r[a]?(r[a].p(o,n),ve(r[a],1)):(r[a]=Kt(o),r[a].c(),ve(r[a],1),r[a].m(t,null))}for(fe(),a=i.length;a<r.length;a+=1)o(a);me()}},i(e){if(!n){for(let e=0;e<i.length;e+=1)ve(r[e]);n=!0}},o(e){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)ge(r[t]);n=!1},d(e){e&&C(t),function(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}(r,e)}}}function en(e,t,n){let i,{floorIndex:r}=t,{pxmm:o}=t,{floorplanData:a}=t;return e.$$set=e=>{"floorIndex"in e&&n(1,r=e.floorIndex),"pxmm"in e&&n(2,o=e.pxmm),"floorplanData"in e&&n(3,a=e.floorplanData)},e.$$.update=()=>{14&e.$$.dirty&&n(0,i=a.floorDatas[r].rooms.map((e=>__spreadProps(__spreadValues({},e),{path:e.path.map((e=>Ge(e,o,a.bounding)))}))))},[i,r,o,a]}class tn extends Le{constructor(e){super(),Pe(this,e,en,$t,y,{floorIndex:1,pxmm:2,floorplanData:3})}}function nn(e){let t;return{c(){t=R("path"),z(t,"d",e[0]),z(t,"fill","#fff"),z(t,"class","svelte-11takew")},m(e,n){L(e,t,n)},p:u,i:u,o:u,d(e){e&&C(t)}}}function rn(e,t,n){let{pxmm:i}=t,{room:r}=t,{floorplanData:o}=t;const{bounding:a}=o,s=Ue(r.path,{needZ:!0,format:e=>Ge(e,i,a)});return e.$$set=e=>{"pxmm"in e&&n(1,i=e.pxmm),"room"in e&&n(2,r=e.room),"floorplanData"in e&&n(3,o=e.floorplanData)},[s,i,r,o]}class on extends Le{constructor(e){super(),Pe(this,e,rn,nn,y,{pxmm:1,room:2,floorplanData:3})}}function an(e,t,n){const i=e.slice();return i[12]=t[n],i}function sn(e,t){let n,i,r;const o=[{room:t[12],floorplanData:t[2],pxmm:t[0]}];let a={};for(let s=0;s<o.length;s+=1)a=d(a,o[s]);return i=new on({props:a}),{key:e,first:null,c(){n=N(),Ee(i.$$.fragment),this.first=n},m(e,t){L(e,n,t),Se(i,e,t),r=!0},p(e,n){t=e;const r=7&n?Me(o,[{room:t[12],floorplanData:t[2],pxmm:t[0]}]):{};i.$set(r)},i(e){r||(ve(i.$$.fragment,e),r=!0)},o(e){ge(i.$$.fragment,e),r=!1},d(e){e&&C(n),Ae(i,e)}}}function ln(e){let t,n,i,r,o,a,s=[],l=new Map,c=e[2].floorDatas[e[1]].rooms;const h=e=>e[12].id;for(let u=0;u<c.length;u+=1){let t=an(e,c,u),n=h(t);l.set(n,s[u]=sn(n,t))}return{c(){t=I("div"),n=R("svg");for(let e=0;e<s.length;e+=1)s[e].c();z(n,"class","svelte-1aais5l"),z(t,"class","floorplan-plugin__room-highlight svelte-1aais5l"),oe((()=>e[10].call(t)))},m(l,c){L(l,t,c),A(t,n);for(let e=0;e<s.length;e+=1)s[e].m(n,null);e[9](t),i=U(t,e[10].bind(t)),r=!0,o||(a=F(t,"click",e[6]),o=!0)},p(e,[t]){7&t&&(c=e[2].floorDatas[e[1]].rooms,fe(),s=_e(s,t,h,1,e,c,l,n,we,sn,null,an),me())},i(e){if(!r){for(let e=0;e<c.length;e+=1)ve(s[e]);r=!0}},o(e){for(let t=0;t<s.length;t+=1)ge(s[t]);r=!1},d(n){n&&C(t);for(let e=0;e<s.length;e+=1)s[e].d();e[9](null),i(),o=!1,a()}}}function cn(e,n,i){let r,o,a,{five:s}=n,{pxmm:l}=n,{floorIndex:c}=n,{floorplanData:h}=n,{onRoomHeightClick:u}=n;const{observers:p}=h;return e.$$set=e=>{"five"in e&&i(7,s=e.five),"pxmm"in e&&i(0,l=e.pxmm),"floorIndex"in e&&i(1,c=e.floorIndex),"floorplanData"in e&&i(2,h=e.floorplanData),"onRoomHeightClick"in e&&i(8,u=e.onRoomHeightClick)},[l,c,h,r,o,a,function(e){if(!1===(null==u?void 0:u(e)))return;const n=a.getBoundingClientRect(),i=new t.Vector2(e.clientX,e.clientY),l=new t.Vector2(n.left,n.top),h=i.clone().sub(l),d=new t.Vector2(h.x/r,h.y/o),f=p.filter((e=>e.floorIndex===c)).sort(((e,n)=>{const i=new t.Vector2(e.positionInImage.x,e.positionInImage.y),r=new t.Vector2(n.positionInImage.x,n.positionInImage.y);return i.distanceTo(d)-r.distanceTo(d)}))[0];s.moveToPano(f.index)},s,u,function(e){ee[e?"unshift":"push"]((()=>{a=e,i(5,a)}))},function(){r=this.clientWidth,o=this.clientHeight,i(3,r),i(4,o)}]}class hn extends Le{constructor(e){super(),Pe(this,e,cn,ln,y,{five:7,pxmm:0,floorIndex:1,floorplanData:2,onRoomHeightClick:8})}}function un(e){let t,n;const i=[{five:e[1],pxmm:e[0],floorIndex:e[2],floorplanData:e[6],onRoomHeightClick:e[7]}];let r={};for(let o=0;o<i.length;o+=1)r=d(r,i[o]);return t=new hn({props:r}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const r=199&n?Me(i,[{five:e[1],pxmm:e[0],floorIndex:e[2],floorplanData:e[6],onRoomHeightClick:e[7]}]):{};t.$set(r)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function pn(e){let t,n;const i=[{floorplanData:e[6],floorIndex:e[2],getLabelElement:e[8]}];let r={};for(let o=0;o<i.length;o+=1)r=d(r,i[o]);return t=new ft({props:r}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const r=324&n?Me(i,[{floorplanData:e[6],floorIndex:e[2],getLabelElement:e[8]}]):{};t.$set(r)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function dn(e){let t,n;const i=[{floorplanData:e[6],floorIndex:e[2],pxmm:e[0]}];let r={};for(let o=0;o<i.length;o+=1)r=d(r,i[o]);return t=new Tt({props:r}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const r=69&n?Me(i,[{floorplanData:e[6],floorIndex:e[2],pxmm:e[0]}]):{};t.$set(r)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function fn(e){let t,n,i,r,o,a,s,l;const c=[{floorIndex:e[2],floorplanData:e[6],pxmm:e[0]}];let h={};for(let g=0;g<c.length;g+=1)h=d(h,c[g]);n=new tn({props:h});let u=e[3]&&un(e);const p=[{floorplanData:e[6],floorIndex:e[2]}];let f={};for(let g=0;g<p.length;g+=1)f=d(f,p[g]);o=new Bt({props:f});let m=e[4]&&pn(e),v=e[5]&&dn(e);return{c(){t=I("div"),Ee(n.$$.fragment),i=D(),u&&u.c(),r=D(),Ee(o.$$.fragment),a=D(),m&&m.c(),s=D(),v&&v.c(),z(t,"class","floorplan-current-floor svelte-3pdgs4")},m(e,c){L(e,t,c),Se(n,t,null),A(t,i),u&&u.m(t,null),A(t,r),Se(o,t,null),A(t,a),m&&m.m(t,null),A(t,s),v&&v.m(t,null),l=!0},p(e,[i]){const a=69&i?Me(c,[{floorIndex:e[2],floorplanData:e[6],pxmm:e[0]}]):{};n.$set(a),e[3]?u?(u.p(e,i),8&i&&ve(u,1)):(u=un(e),u.c(),ve(u,1),u.m(t,r)):u&&(fe(),ge(u,1,1,(()=>{u=null})),me());const l=68&i?Me(p,[{floorplanData:e[6],floorIndex:e[2]}]):{};o.$set(l),e[4]?m?(m.p(e,i),16&i&&ve(m,1)):(m=pn(e),m.c(),ve(m,1),m.m(t,s)):m&&(fe(),ge(m,1,1,(()=>{m=null})),me()),e[5]?v?(v.p(e,i),32&i&&ve(v,1)):(v=dn(e),v.c(),ve(v,1),v.m(t,null)):v&&(fe(),ge(v,1,1,(()=>{v=null})),me())},i(e){l||(ve(n.$$.fragment,e),ve(u),ve(o.$$.fragment,e),ve(m),ve(v),l=!0)},o(e){ge(n.$$.fragment,e),ge(u),ge(o.$$.fragment,e),ge(m),ge(v),l=!1},d(e){e&&C(t),Ae(n),u&&u.d(),Ae(o),m&&m.d(),v&&v.d()}}}function mn(e,t,n){let{pxmm:i}=t,{five:r}=t,{floorIndex:o}=t,{hoverEnable:a}=t,{roomLabelsEnable:s}=t,{ruleLabelsEnable:l}=t,{floorplanData:c}=t,{onRoomHeightClick:h}=t,{getLabelElement:u}=t;return e.$$set=e=>{"pxmm"in e&&n(0,i=e.pxmm),"five"in e&&n(1,r=e.five),"floorIndex"in e&&n(2,o=e.floorIndex),"hoverEnable"in e&&n(3,a=e.hoverEnable),"roomLabelsEnable"in e&&n(4,s=e.roomLabelsEnable),"ruleLabelsEnable"in e&&n(5,l=e.ruleLabelsEnable),"floorplanData"in e&&n(6,c=e.floorplanData),"onRoomHeightClick"in e&&n(7,h=e.onRoomHeightClick),"getLabelElement"in e&&n(8,u=e.getLabelElement)},[i,r,o,a,s,l,c,h,u]}class vn extends Le{constructor(e){super(),Pe(this,e,mn,fn,y,{pxmm:0,five:1,floorIndex:2,hoverEnable:3,roomLabelsEnable:4,ruleLabelsEnable:5,floorplanData:6,onRoomHeightClick:7,getLabelElement:8})}}function gn(e){let t,n,i,r,o,a,s;const l=[{five:e[1],pxmm:e[0],floorIndex:e[5],hoverEnable:e[6],floorplanData:e[10],getLabelElement:e[14],roomLabelsEnable:e[8],ruleLabelsEnable:e[9],onRoomHeightClick:e[13]}];let c={};for(let p=0;p<l.length;p+=1)c=d(c,l[p]);n=new vn({props:c});const h=[{panoIndex:e[4],floorplanData:e[10],lastPanoramaLongitude:e[11],cameraImageUrl:e[12]}];let u={};for(let p=0;p<h.length;p+=1)u=d(u,h[p]);r=new $e({props:u});let f=e[7]&&yn(e);return{c(){t=I("div"),Ee(n.$$.fragment),i=D(),Ee(r.$$.fragment),o=D(),f&&f.c(),z(t,"class","floorplan-main svelte-177x2q7")},m(e,a){L(e,t,a),Se(n,t,null),A(t,i),Se(r,t,null),A(t,o),f&&f.m(t,null),s=!0},p(i,o){e=i;const a=26467&o?Me(l,[{five:e[1],pxmm:e[0],floorIndex:e[5],hoverEnable:e[6],floorplanData:e[10],getLabelElement:e[14],roomLabelsEnable:e[8],ruleLabelsEnable:e[9],onRoomHeightClick:e[13]}]):{};n.$set(a);const s=7184&o?Me(h,[{panoIndex:e[4],floorplanData:e[10],lastPanoramaLongitude:e[11],cameraImageUrl:e[12]}]):{};r.$set(s),e[7]?f?(f.p(e,o),128&o&&ve(f,1)):(f=yn(e),f.c(),ve(f,1),f.m(t,null)):f&&(fe(),ge(f,1,1,(()=>{f=null})),me())},i(i){s||(ve(n.$$.fragment,i),ve(r.$$.fragment,i),ve(f),a||oe((()=>{a=xe(t,it,{duration:e[2],easing:p}),a.start()})),s=!0)},o(e){ge(n.$$.fragment,e),ge(r.$$.fragment,e),ge(f),s=!1},d(e){e&&C(t),Ae(n),Ae(r),f&&f.d()}}}function yn(e){let t,n;return t=new nt({props:{floorplanData:e[10]}}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const i={};1024&n&&(i.floorplanData=e[10]),t.$set(i)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function xn(e){let t,n,i=e[3]&&gn(e);return{c(){i&&i.c(),t=N()},m(e,r){i&&i.m(e,r),L(e,t,r),n=!0},p(e,[n]){e[3]?i?(i.p(e,n),8&n&&ve(i,1)):(i=gn(e),i.c(),ve(i,1),i.m(t.parentNode,t)):i&&(fe(),ge(i,1,1,(()=>{i=null})),me())},i(e){n||(ve(i),n=!0)},o(e){ge(i),n=!1},d(e){i&&i.d(e),e&&C(t)}}}function bn(e,t,n){let{pxmm:i}=t,{five:r}=t,{duration:o=0}=t,{visible:a}=t,{panoIndex:s}=t,{floorIndex:l}=t,{hoverEnable:c}=t,{compassEnable:h}=t,{roomLabelsEnable:u}=t,{ruleLabelsEnable:p}=t,{floorplanData:d}=t,{lastPanoramaLongitude:f}=t,{cameraImageUrl:m}=t,{onRoomHeightClick:v}=t,{getLabelElement:g}=t;return e.$$set=e=>{"pxmm"in e&&n(0,i=e.pxmm),"five"in e&&n(1,r=e.five),"duration"in e&&n(2,o=e.duration),"visible"in e&&n(3,a=e.visible),"panoIndex"in e&&n(4,s=e.panoIndex),"floorIndex"in e&&n(5,l=e.floorIndex),"hoverEnable"in e&&n(6,c=e.hoverEnable),"compassEnable"in e&&n(7,h=e.compassEnable),"roomLabelsEnable"in e&&n(8,u=e.roomLabelsEnable),"ruleLabelsEnable"in e&&n(9,p=e.ruleLabelsEnable),"floorplanData"in e&&n(10,d=e.floorplanData),"lastPanoramaLongitude"in e&&n(11,f=e.lastPanoramaLongitude),"cameraImageUrl"in e&&n(12,m=e.cameraImageUrl),"onRoomHeightClick"in e&&n(13,v=e.onRoomHeightClick),"getLabelElement"in e&&n(14,g=e.getLabelElement)},[i,r,o,a,s,l,c,h,u,p,d,f,m,v,g]}class wn extends Le{constructor(e){super(),Pe(this,e,bn,xn,y,{pxmm:0,five:1,duration:2,visible:3,panoIndex:4,floorIndex:5,hoverEnable:6,compassEnable:7,roomLabelsEnable:8,ruleLabelsEnable:9,floorplanData:10,lastPanoramaLongitude:11,cameraImageUrl:12,onRoomHeightClick:13,getLabelElement:14})}}function _n(e,t,n=300){const i=e.getElement();i&&(i.style.opacity=t+"",i.style.transition=0===n?"none":`opacity ${n}ms linear`,0!==n&&Promise.race([new Promise((e=>i.addEventListener("transitionend",e,{once:!0}))),new Promise((e=>setTimeout(e,n)))]).then((()=>{i.style.transition="none"})))}class Mn{constructor(e,t){__publicField(this,"size",{width:0,height:0}),__publicField(this,"visible",!1),__publicField(this,"pxmm",0),__publicField(this,"app"),__publicField(this,"five"),__publicField(this,"panoIndex",0),__publicField(this,"floorIndex",0),__publicField(this,"configs",{}),__publicField(this,"lastPanoramaLongitude",0),__publicField(this,"selector"),__publicField(this,"floorplanData"),__publicField(this,"wrapper"),__publicField(this,"container",document.createElement("div")),__publicField(this,"dispose",(()=>{var e,t;this.hide(),null==(e=this.container)||e.remove(),null==(t=this.app)||t.$destroy(),this.five.off("modeChange",this.handleModeChange),this.five.off("panoArrived",this.handlePanoArrived),this.five.off("modelLoaded",this.handleModelLoaded),this.five.off("wantsMoveToPano",this.handleWantsMoveToPano),this.five.off("wantsPanGesture",this.handleWantsPanGesture),this.five.off("initAnimationEnded",this.handleInitAnimationEnded),this.five.off("modelShownFloorChange",this.onModelShownFloorChange)})),__publicField(this,"onModelShownFloorChange",(e=>{null!==e&&(this.floorIndex=e,this.updateSize(),this.render())})),__publicField(this,"handlePanoArrived",(e=>{var t;(null==(t=this.five)?void 0:t.work)&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)})),__publicField(this,"handleWantsMoveToPano",(()=>{if(this.visible)return!this.configs.preventRoomClick&&void 0})),__publicField(this,"handleWantsPanGesture",(()=>{if(this.visible)return!1})),__publicField(this,"handleModelLoaded",(()=>{if(this.wrapper)return;if(!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)})),__publicField(this,"handleModeChange",(e=>{if("Topview"!==e)return this.hide()})),__publicField(this,"handleInitAnimationEnded",(()=>{const{mode:e}=this.five.getCurrentState();"Topview"===e&&this.show()})),__publicField(this,"updateSize",(()=>{if(!this.floorplanData)return;if(!this.container||!this.wrapper)return;if("Topview"!==this.five.getCurrentState().mode)return;const{min:e,max:t}=this.floorplanData.bounding,n=t.x-e.x,i=t.y-e.y,r=this.configs.attachedTo?{attachedTo:this.configs.attachedTo}:void 0,o=Qe(this.five,this.wrapper,this.floorIndex,r),a=Math.ceil(n*o),s=Math.ceil(i*o);this.pxmm=o,this.size={width:a,height:s},this.container.style.width=a+"px",this.container.style.height=s+"px"})),this.five=e,this.selector=t.selector,this.configs=Ye(t,["selector"]),this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,He),this.five.model.loaded?this.handleModelLoaded():e.once("modelLoaded",this.handleModelLoaded),this.five.once("dispose",this.dispose),this.five.on("modeChange",this.handleModeChange),this.five.on("panoArrived",this.handlePanoArrived),this.five.on("initAnimationEnded",this.handleInitAnimationEnded),this.five.on("modelShownFloorChange",this.onModelShownFloorChange)}async load(e){const t=JSON.parse(JSON.stringify(e));this.floorplanData=await qe(t),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this}show(){this.visible=!0,this.five.model.show(this.floorIndex),this.updateSize();const e=this.configs.modelOpacity;"number"==typeof e&&_n(this.five,e,500),this.render(500),this.five.on("wantsMoveToPano",this.handleWantsMoveToPano),this.five.on("wantsPanGesture",this.handleWantsPanGesture)}hide(){this.visible=!1,_n(this.five,1,0),this.render(),this.five.on("wantsMoveToPano",this.handleWantsMoveToPano),this.five.on("wantsPanGesture",this.handleWantsPanGesture)}render(e){if(!this.container||!this.floorplanData)return;if(0===this.size.width)return;const{getLabelElement:t,cameraImageUrl:n,preventRoomClick:i,hoverEnable:r,compassEnable:o,roomLabelsEnable:a,ruleLabelsEnable:s}=this.configs,l=i?()=>!1:void 0,c={five:this.five,pxmm:this.pxmm,cameraImageUrl:n,visible:this.visible,duration:null!=e?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.floorplanData,hoverEnable:null!=r&&r,compassEnable:null==o||o,ruleLabelsEnable:null==s||s,roomLabelsEnable:null==a||a,lastPanoramaLongitude:this.lastPanoramaLongitude,getLabelElement:t,onRoomHeightClick:l};this.app?this.app.$set(c):this.app=new wn({target:this.container,intro:!0,props:c})}}function En(e,t=200){let n;return function(...i){n||(e(...i),n=setTimeout((function(){n=null}),t))}}function Sn(e){let t,n,i;return{c(){t=I("div"),n=I("div"),i=I("div"),z(i,"class","plugin-radar__camera-rotate svelte-o7uo2v"),k(i,"background-image","url("+(e[0]||Ze)+")"),k(i,"transform",e[1],!1),z(n,"class","plugin-radar__camera-position svelte-o7uo2v"),k(n,"transform",e[2],!1),z(t,"class","plugin-radar__camera-wrapper svelte-o7uo2v")},m(e,r){L(e,t,r),A(t,n),A(n,i)},p(e,[t]){1&t&&k(i,"background-image","url("+(e[0]||Ze)+")"),2&t&&k(i,"transform",e[1],!1),4&t&&k(n,"transform",e[2],!1)},i:u,o:u,d(e){e&&C(t)}}}function An(e,t,n){let{five:i}=t,{pxmm:r}=t,{floorplanData:o}=t,{cameraImageUrl:a}=t;function s(e){const t=o.observers[e],n=o.bounding,i=(n.max.x-n.min.x)*r,a=(n.max.y-n.min.y)*r;if(!t)return"";return`translate(${Math.floor(t.positionInImage.x*i)}px, ${Math.floor(t.positionInImage.y*a)}px)`}function l(){const{longitude:e}=i.getCurrentState();return`rotate(${-1*Math.floor(e/Math.PI*180)+45}deg)`}const c=e=>{n(2,p=s(e))},h=En((()=>{n(1,u=l())}),1e3/60);let u=l(),p=s(i.getCurrentState().panoIndex);return J((()=>{i.on("panoWillArrive",c),i.on("cameraDirectionUpdate",h)})),K((()=>{i.off("panoWillArrive",c),i.off("cameraDirectionUpdate",h)})),e.$$set=e=>{"five"in e&&n(3,i=e.five),"pxmm"in e&&n(4,r=e.pxmm),"floorplanData"in e&&n(5,o=e.floorplanData),"cameraImageUrl"in e&&n(0,a=e.cameraImageUrl)},[a,u,p,i,r,o]}class Tn extends Le{constructor(e){super(),Pe(this,e,An,Sn,y,{five:3,pxmm:4,floorplanData:5,cameraImageUrl:0})}}function Pn(e,t,n){const i=e.slice();return i[1]=t[n],i}function Ln(e,t){let n,i,r,o=t[1].icon.width/16+"rem",a=t[1].icon.height/16+"rem",s=100*t[1].positionInImage.y+"%",l=100*t[1].positionInImage.x+"%";return{key:e,first:null,c(){n=I("div"),i=I("div"),r=D(),z(i,"class","plugin-pano-floorplan__extra-object-item svelte-8n0d4v"),k(i,"background-image",`url(${t[1].icon.url})`),k(i,"width",o,!1),k(i,"height",a,!1),z(n,"class","plugin-pano-floorplan__extra-object-item--position svelte-8n0d4v"),k(n,"top",s,!1),k(n,"left",l,!1),this.first=n},m(e,t){L(e,n,t),A(n,i),A(n,r)},p(e,r){t=e,1&r&&k(i,"background-image",`url(${t[1].icon.url})`),1&r&&o!==(o=t[1].icon.width/16+"rem")&&k(i,"width",o,!1),1&r&&a!==(a=t[1].icon.height/16+"rem")&&k(i,"height",a,!1),1&r&&s!==(s=100*t[1].positionInImage.y+"%")&&k(n,"top",s,!1),1&r&&l!==(l=100*t[1].positionInImage.x+"%")&&k(n,"left",l,!1)},d(e){e&&C(n)}}}function Cn(e){let t,n=[],i=new Map,r=e[0];const o=e=>e[1].id;for(let a=0;a<r.length;a+=1){let t=Pn(e,r,a),s=o(t);i.set(s,n[a]=Ln(s,t))}return{c(){t=I("div");for(let e=0;e<n.length;e+=1)n[e].c();z(t,"class","plugin-pano-floorplan__extra-objects svelte-8n0d4v")},m(e,i){L(e,t,i);for(let r=0;r<n.length;r+=1)n[r].m(t,null)},p(e,[a]){1&a&&(r=e[0],n=_e(n,a,o,1,e,r,i,t,be,Ln,null,Pn))},i:u,o:u,d(e){e&&C(t);for(let t=0;t<n.length;t+=1)n[t].d()}}}function In(e,t,n){let{extraObjects:i=[]}=t;return e.$$set=e=>{"extraObjects"in e&&n(0,i=e.extraObjects)},[i]}class Rn extends Le{constructor(e){super(),Pe(this,e,In,Cn,y,{extraObjects:0})}}function On(e){let t,n;const i=[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[6]}];let r={};for(let o=0;o<i.length;o+=1)r=d(r,i[o]);return t=new hn({props:r}),{c(){Ee(t.$$.fragment)},m(e,i){Se(t,e,i),n=!0},p(e,n){const r=87&n?Me(i,[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[6]}]):{};t.$set(r)},i(e){n||(ve(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Ae(t,e)}}}function Dn(e){let t,n,i,r,o,a;const s=[{floorIndex:e[2],floorplanData:e[4]}];let l={};for(let h=0;h<s.length;h+=1)l=d(l,s[h]);t=new Bt({props:l}),i=new Rn({props:{extraObjects:e[5]}});let c=e[3]&&On(e);return{c(){Ee(t.$$.fragment),n=D(),Ee(i.$$.fragment),r=D(),c&&c.c(),o=N()},m(e,s){Se(t,e,s),L(e,n,s),Se(i,e,s),L(e,r,s),c&&c.m(e,s),L(e,o,s),a=!0},p(e,[n]){const r=20&n?Me(s,[{floorIndex:e[2],floorplanData:e[4]}]):{};t.$set(r);const a={};32&n&&(a.extraObjects=e[5]),i.$set(a),e[3]?c?(c.p(e,n),8&n&&ve(c,1)):(c=On(e),c.c(),ve(c,1),c.m(o.parentNode,o)):c&&(fe(),ge(c,1,1,(()=>{c=null})),me())},i(e){a||(ve(t.$$.fragment,e),ve(i.$$.fragment,e),ve(c),a=!0)},o(e){ge(t.$$.fragment,e),ge(i.$$.fragment,e),ge(c),a=!1},d(e){Ae(t,e),e&&C(n),Ae(i,e),e&&C(r),c&&c.d(e),e&&C(o)}}}function Nn(e,t,n){let i,{five:r}=t,{pxmm:o}=t,{floorIndex:a}=t,{hoverEnable:s}=t,{floorplanData:l}=t,{extraObjects:c=[]}=t;return e.$$set=e=>{"five"in e&&n(0,r=e.five),"pxmm"in e&&n(1,o=e.pxmm),"floorIndex"in e&&n(2,a=e.floorIndex),"hoverEnable"in e&&n(3,s=e.hoverEnable),"floorplanData"in e&&n(4,l=e.floorplanData),"extraObjects"in e&&n(7,c=e.extraObjects)},e.$$.update=()=>{132&e.$$.dirty&&n(5,i=null==c?void 0:c.filter((e=>e.floorIndex===a)))},[r,o,a,s,l,i,void 0,c]}class Fn extends Le{constructor(e){super(),Pe(this,e,Nn,Dn,y,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:7})}}function zn(e){let t,n,i,r,o,a=`${e[7]}px`,s=`${e[10]}px`;const l=[{five:e[0],pxmm:e[8],floorIndex:e[9],floorplanData:e[2],hoverEnable:e[1],extraObjects:e[4]}];let c={};for(let p=0;p<l.length;p+=1)c=d(c,l[p]);n=new Fn({props:c});const h=[{pxmm:e[8],five:e[0],floorplanData:e[2],cameraImageUrl:e[3]}];let u={};for(let p=0;p<h.length;p+=1)u=d(u,h[p]);return r=new Tn({props:u}),{c(){t=I("div"),Ee(n.$$.fragment),i=D(),Ee(r.$$.fragment),z(t,"class","plugin-floorplan-radar-container svelte-7d8ub2"),k(t,"width",a,!1),k(t,"height",s,!1)},m(e,a){L(e,t,a),Se(n,t,null),A(t,i),Se(r,t,null),o=!0},p(e,i){const o=791&i?Me(l,[{five:e[0],pxmm:e[8],floorIndex:e[9],floorplanData:e[2],hoverEnable:e[1],extraObjects:e[4]}]):{};n.$set(o);const c=269&i?Me(h,[{pxmm:e[8],five:e[0],floorplanData:e[2],cameraImageUrl:e[3]}]):{};r.$set(c),128&i&&a!==(a=`${e[7]}px`)&&k(t,"width",a,!1),1024&i&&s!==(s=`${e[10]}px`)&&k(t,"height",s,!1)},i(e){o||(ve(n.$$.fragment,e),ve(r.$$.fragment,e),o=!0)},o(e){ge(n.$$.fragment,e),ge(r.$$.fragment,e),o=!1},d(e){e&&C(t),Ae(n),Ae(r)}}}function Bn(e){let t,n,i,r=0!==e[5]&&zn(e);return{c(){t=I("div"),r&&r.c(),z(t,"class","plugin-floorplan-radar svelte-7d8ub2"),oe((()=>e[11].call(t)))},m(o,a){L(o,t,a),r&&r.m(t,null),n=U(t,e[11].bind(t)),i=!0},p(e,[n]){0!==e[5]?r?(r.p(e,n),32&n&&ve(r,1)):(r=zn(e),r.c(),ve(r,1),r.m(t,null)):r&&(fe(),ge(r,1,1,(()=>{r=null})),me())},i(e){i||(ve(r),i=!0)},o(e){ge(r),i=!1},d(e){e&&C(t),r&&r.d(),n()}}}function kn(e,t,n){let{five:i}=t,{hoverEnable:r}=t,{floorplanData:o}=t,{cameraImageUrl:a}=t,{extraObjects:s=[]}=t,l=0,c=0,h=0,u=0,p=0,d=0;function f(e){n(9,c=i.work.observers[e].floorIndex)}return J((()=>(i.on("panoArrived",f),()=>{i.off("panoArrived",f)}))),e.$$set=e=>{"five"in e&&n(0,i=e.five),"hoverEnable"in e&&n(1,r=e.hoverEnable),"floorplanData"in e&&n(2,o=e.floorplanData),"cameraImageUrl"in e&&n(3,a=e.cameraImageUrl),"extraObjects"in e&&n(4,s=e.extraObjects)},e.$$.update=()=>{if(228&e.$$.dirty){const e=Math.min(h,u),{max:t,min:i}=o.bounding,r=t.x-i.x,a=t.y-i.y,s=r>a?[e,e/r*a]:[e/a*r,e];n(7,p=s[0]),n(10,d=s[1]),n(8,l=p/r)}},[i,r,o,a,s,h,u,p,l,c,d,function(){h=this.clientWidth,u=this.clientHeight,n(5,h),n(6,u)}]}class Hn extends Le{constructor(e){super(),Pe(this,e,kn,Bn,y,{five:0,hoverEnable:1,floorplanData:2,cameraImageUrl:3,extraObjects:4})}}class Un{constructor(e,t){__publicField(this,"app"),__publicField(this,"five"),__publicField(this,"wrapperSelector",""),__publicField(this,"data"),__publicField(this,"wrapper",null),__publicField(this,"extraObjects"),__publicField(this,"originExtraObjects"),__publicField(this,"configs",{}),__publicField(this,"dispose",(()=>{var e;null==(e=this.app)||e.$destroy()})),__publicField(this,"load",(async e=>{const t=JSON.parse(JSON.stringify(e)),n=await qe(t);this.data=n,this.render()})),this.five=e,(null==t?void 0:t.configs)&&Object.assign(this.configs,t.configs),"string"==typeof(null==t?void 0:t.wrapper)?this.wrapperSelector=t.wrapper:(null==t?void 0:t.wrapper)instanceof Element&&(this.wrapper=t.wrapper),e.once("dispose",this.dispose)}appendTo(e){this.wrapper=e,this.render()}changeConfigs(e){Object.assign(this.configs,e),this.render()}setExtraObjectsWith3DPositions(e){this.originExtraObjects=e,this.data&&(this.extraObjects=Xe(e,this.five,this.data),this.render())}render(){var e;if(!this.wrapper){const e=document.querySelector(this.wrapperSelector);this.wrapper=e}if(!this.data||!this.wrapper)return;!this.extraObjects&&this.originExtraObjects&&(this.extraObjects=Xe(this.originExtraObjects,this.five,this.data));const t={five:this.five,floorplanData:this.data,extraObjects:this.extraObjects,cameraImageUrl:this.configs.cameraImageUrl,hoverEnable:null!=(e=this.configs.hoverEnable)&&e};this.app?this.app.$set(t):this.app=new Hn({target:this.wrapper,props:t})}}async function Gn(e){try{return[null,await e]}catch(t){return t instanceof Error?[t,null]:[new Error(""),null]}}function jn(e){return"[object Object]"===Object.prototype.toString.call(e)}function Vn(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function Wn(e,t){return!!Vn(e,t)||(jn(e)&&jn(t)?function(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let r=0,o=n.length;r<o;r++){const i=n[r];if(!Vn(e[i],t[i]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(!Vn(e[n],t[n]))return!1;return!0}(e,t))}function qn(e,t){return!!Vn(e,t)||(jn(e)&&jn(t)?function(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let r=0,o=n.length;r<o;r++){const i=n[r];if(!qn(e[i],t[i]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(!qn(e[n],t[n]))return!1;return!0}(e,t))}var Xn=(e=>(e.UnknownError="UnknowError",e.DataNotLoaded="DataNotLoaded",e.BreakOffByHide="BreakOffByHide",e.ModelNotLoaded="ModelNotLoaded",e.ChangeModeError="ChangeModeError",e.UpdateCameraError="UpdateCameraError",e.DifferentShowParams="DifferentShowParams",e))(Xn||{});function Yn(e,t,n=4){return Math.floor(e*Math.pow(10,n))===Math.floor(t*Math.pow(10,n))}function Qn(e,t){if(e.currentMode!==r.Five.Mode.Floorplan)return!1;const{latitude:n,longitude:i,fov:o}=t,{latitude:a,longitude:s}=e.getCurrentState(),l=e.camera.fov;return!(!Yn(n,a,1)||!Yn(i,s,1)||o!==l)}async function Zn(e,t,n=!0){if(!0===Qn(e,t))return;if(e.currentMode!==r.Five.Mode.Floorplan){const[i]=await Gn(async function(e,...t){const[n]=await Gn(e.changeMode(...t));if(n)throw n;await new Promise(((n,i)=>{e.once("initAnimationEnded",n);const r=n=>{n!==t[0]&&i("changeMode 被中断"),e.off("modeChange",r)};e.on("modeChange",r)}))}(e,r.Five.Mode.Floorplan,t,void 0,n));if(i)throw i;if(!1===Qn(e,t))throw new Error(Xn.ChangeModeError);return}const{latitude:i,longitude:o,fov:a}=e.getCurrentState(),s=Math.min(1e3,Math.max(200,1e3*Math.abs(i-Math.PI/2),500*(o>Math.PI?2*Math.PI-o:o),10*Math.abs(a-t.fov))),[l]=await Gn(e.updateCamera(t,s,n));if(l)throw new Error(Xn.UpdateCameraError)}class Jn{constructor(e,t){var n;__publicField(this,"name","modelFloorplanPlugin"),__publicField(this,"hooks"),__publicField(this,"visible",!1),__publicField(this,"size",{width:0,height:0}),__publicField(this,"app"),__publicField(this,"pxmm",0),__publicField(this,"five"),__publicField(this,"panoIndex",0),__publicField(this,"floorIndex",0),__publicField(this,"configs",{}),__publicField(this,"lastPanoramaLongitude",0),__publicField(this,"selector"),__publicField(this,"floorplanData"),__publicField(this,"wrapper"),__publicField(this,"container",document.createElement("div")),__publicField(this,"showState"),__publicField(this,"ModelFloorplanPluginsShowOpts"),__publicField(this,"showPromise"),__publicField(this,"showRejection"),__publicField(this,"dispose",(()=>{var e,t;const n=this.five;this.hide(),null==(e=this.app)||e.$destroy(),null==(t=this.container)||t.remove(),n.off("modelLoaded",this.handleModelLoaded),n.off("modeChange",this.handleModeChange),n.off("panGesture",this.handlePanGesture),n.off("panoArrived",this.handlePanoArrived),n.off("wantsChangeMode",this.handleWantsChangeMode),n.off("wantsInteriaPan",this.handleWantsInteriaPan),n.off("wantsTapGesture",this.handleWantsTapGesture),n.off("modelShownFloorChange",this.onModelShownFloorChange)})),__publicField(this,"updateSize",(()=>{if(!this.floorplanData)return;if(!Qn(this.five,this.showState))return;if(!this.container||!this.wrapper)return;const{min:e,max:t}=this.floorplanData.bounding,n=t.x-e.x,i=t.y-e.y,r=this.configs.attachedTo?{attachedTo:this.configs.attachedTo}:void 0,o=Qe(this.five,this.wrapper,this.floorIndex,r),a=Math.ceil(n*o),s=Math.ceil(i*o);this.size.width===a&&this.size.height===s||(this.pxmm=o,this.size={width:a,height:s},this.container.style.width=a+"px",this.container.style.height=s+"px")})),__publicField(this,"show",(async e=>{var t,n;if(!this.showPromise&&this.visible)return!0;if(!(null==(t=this.five.model)?void 0:t.loaded))throw new Error(Xn.ModelNotLoaded);if(!this.floorplanData)throw new Error(Xn.DataNotLoaded);if(this.visible=!0,this.showPromise){const t=function(e,t,n={deep:!1}){return n.deep?qn(e,t):Wn(e,t)}(e,this.ModelFloorplanPluginsShowOpts,{deep:!1});if(this.showPromise&&t)return this.showPromise;this.showPromise&&!t&&(null==(n=this.showRejection)||n.call(this,Xn.DifferentShowParams))}this.ModelFloorplanPluginsShowOpts=e;const i=(async()=>{var t,n;let i,r=!1;this.showRejection=e=>{r=!0,i=e};const[o]=await Gn(Zn(this.five,this.showState,null==e?void 0:e.userAction));if(o)throw o;if(r)throw i?new Error(i):new Error(Xn.UnknownError);if(!this.visible)throw new Error(Xn.UnknownError);this.visible=!0,this.updateSize(),(null==e?void 0:e.floorIndex)&&(this.floorIndex=e.floorIndex),this.five.model.show(this.floorIndex);const a=null!=(n=null!=(t=null==e?void 0:e.modelOpacity)?t:this.configs.modelOpacity)?n:1,s=(null==e?void 0:e.immediately)?0:500;return _n(this.five,a,s),this.render(s),this.five.on("wantsGesture",this.handleWantsGesture),this.five.on("wantsTapGesture",this.handleWantsTapGesture),!0})().then((()=>{var t;return this.hooks.emit("showAnimationEnded",{auto:!!(null==e?void 0:e.isAutoShow),userAction:null==(t=null==e?void 0:e.userAction)||t}),!0})).catch((t=>{if(null==e?void 0:e.isAutoShow)return!1;if(!(t instanceof Error))return!1;throw t})).finally((()=>{this.showPromise=void 0,this.showRejection=void 0}));return this.showPromise=i,i})),__publicField(this,"hide",(e=>{var t,n;if(0===this.size.width)return!0;if(!1===this.visible)return!0;const i=!!(null==e?void 0:e.isAutoHide);return this.five.off("wantsGesture",this.handleWantsGesture),this.five.off("wantsTapGesture",this.handleWantsTapGesture),this.visible=!1,null==(t=this.showRejection)||t.call(this,Xn.BreakOffByHide),_n(this.five,1,0),this.render(),this.hooks.emit("hide",{auto:i,userAction:null==(n=null==e?void 0:e.userAction)||n}),!0})),__publicField(this,"onModelShownFloorChange",(e=>{null!==e&&(this.floorIndex=e,this.updateSize(),this.render())})),__publicField(this,"handleModelLoaded",(()=>{if(this.wrapper)return;if(!this.selector)return;const e=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!e)throw new Error("不正确的父容器选择器");this.wrapper=e,e.append(this.container)})),__publicField(this,"handleClick",(()=>{if(!this.visible)return;return!this.hooks.emit("click")&&void 0})),__publicField(this,"handleWantsTapGesture",(()=>this.handleClick())),__publicField(this,"handleWantsChangeMode",(e=>{"Panorama"!==e&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude),"Floorplan"!==e&&this.hide()})),__publicField(this,"handleModeChange",(e=>{"Floorplan"===e?this.five.on("panGesture",this.handlePanGesture):(this.hide(),this.five.off("panGesture",this.handlePanGesture))})),__publicField(this,"handlePanoArrived",(e=>{var t;(null==(t=this.five)?void 0:t.work)&&(this.panoIndex=e,this.floorIndex=this.five.work.observers[e].floorIndex)})),__publicField(this,"handleWantsInteriaPan",(()=>{if(this.visible)return!1})),__publicField(this,"handleWantsGesture",((e,t)=>{if(this.visible)return!(t.length>1)&&("mouseWheel"!==e&&void 0)})),__publicField(this,"handlePanGesture",(async({latitude:e,longitude:t},n)=>{if(!1===this.configs.autoShowEnable)return;if(n&&this.visible)return this.five.setState(this.showState,!0);const i=Math.abs(e-Math.PI/2)>5*Math.PI/180,r=t>Math.PI/180*5&&t<Math.PI/180*355,o=i||r;if(this.visible&&o)return this.hide({isAutoHide:!0});if(this.five.camera.fov/80<.8)return;const a=Math.abs(e-Math.PI/2)<10*Math.PI/180,s=t<Math.PI/180*30||t>Math.PI/180*330;if(n&&!this.visible&&a&&s){const e=async(t,n)=>{n&&(this.five.off("interiaPan",e),await this.show({isAutoShow:!0}))};this.five.on("interiaPan",e)}else;})),this.five=e,this.hooks=new r.Subscribe,this.selector=t.selector,this.configs=Ye(t,["selector"]),this.showState={longitude:0,latitude:Math.PI/2,fov:80/(null!=(n=null==t?void 0:t.scale)?n:1)},this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10}),this.five.model.loaded?this.handleModelLoaded():e.once("modelLoaded",this.handleModelLoaded),e.once("dispose",this.dispose),e.on("modeChange",this.handleModeChange),e.on("panGesture",this.handlePanGesture),e.on("panoArrived",this.handlePanoArrived),e.on("wantsChangeMode",this.handleWantsChangeMode),e.on("wantsInteriaPan",this.handleWantsInteriaPan),e.on("modelShownFloorChange",this.onModelShownFloorChange)}async load(e){const t=JSON.parse(JSON.stringify(e));this.floorplanData=await qe(t),this.render()}appendTo(e){return this.wrapper=e,e.appendChild(this.container),this}changeFloor(e){this.five.model.show(e),this.floorIndex=e,this.render()}changeConfigs(e){Object.assign(this.configs,e),this.container&&this.render()}render(e){if(!this.container||!this.floorplanData)return;if(0===this.size.width)return;const{hoverEnable:t,cameraImageUrl:n,getLabelElement:i,roomLabelsEnable:r,compassEnable:o,ruleLabelsEnable:a}=this.configs,s={five:this.five,pxmm:this.pxmm,cameraImageUrl:n,visible:this.visible,duration:null!=e?e:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.floorplanData,hoverEnable:null!=t&&t,compassEnable:null==o||o,ruleLabelsEnable:null==a||a,roomLabelsEnable:null==r||r,lastPanoramaLongitude:this.lastPanoramaLongitude,getLabelElement:i,onRoomHeightClick:this.handleClick};this.app?this.app.$set(s):this.app=new wn({target:this.container,intro:!0,props:s})}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let n=1;n<arguments.length;n++){const e=arguments[n];if(null!=e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t});const Kn=100,$n=306,ei=1e3,ti=1001,ni=1002,ii=1003,ri=1004,oi=1005,ai=1006,si=1008,li=1009,ci=1012,hi=1014,ui=1015,pi=1016,di=1020,fi=1022,mi=1023,vi=1026,gi=1027,yi=2300,xi=2301,bi=2302,wi=2400,_i=2401,Mi=2402,Ei=2500,Si=3e3,Ai=3001,Ti=7680,Pi=35044,Li=35048;function Ci(){}Object.assign(Ci.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var Ii=[],Ri=0;Ri<256;Ri++)Ii[Ri]=(Ri<16?"0":"")+Ri.toString(16);var Oi,Di={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Ii[255&e]+Ii[e>>8&255]+Ii[e>>16&255]+Ii[e>>24&255]+"-"+Ii[255&t]+Ii[t>>8&255]+"-"+Ii[t>>16&15|64]+Ii[t>>24&255]+"-"+Ii[63&n|128]+Ii[n>>8&255]+"-"+Ii[n>>16&255]+Ii[n>>24&255]+Ii[255&i]+Ii[i>>8&255]+Ii[i>>16&255]+Ii[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Di.DEG2RAD},radToDeg:function(e){return e*Di.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((t+i)/2),h=a((t+i)/2),u=o((t-i)/2),p=a((t-i)/2),d=o((i-t)/2),f=a((i-t)/2);switch(r){case"XYX":e.set(s*h,l*u,l*p,s*c);break;case"YZY":e.set(l*p,s*h,l*u,s*c);break;case"ZXZ":e.set(l*u,l*p,s*h,s*c);break;case"XZX":e.set(s*h,l*f,l*d,s*c);break;case"YXY":e.set(l*d,s*h,l*f,s*c);break;case"ZYZ":e.set(l*f,l*d,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function Ni(e,t){this.x=e||0,this.y=t||0}function Fi(){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.")}Object.defineProperties(Ni.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Ni.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Fi.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=i[0],m=i[3],v=i[6],g=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=o*f+a*g+s*b,r[3]=o*m+a*y+s*w,r[6]=o*v+a*x+s*_,r[1]=l*f+c*g+h*b,r[4]=l*m+c*y+h*w,r[7]=l*v+c*x+h*_,r[2]=u*f+p*g+d*b,r[5]=u*m+p*y+d*w,r[8]=u*v+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*o*c-t*a*l-n*r*c+n*a*s+i*r*l-i*o*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],l=n[4],c=n[5],h=n[6],u=n[7],p=n[8],d=p*l-c*u,f=c*h-p*s,m=u*s-l*h,v=r*d+o*f+a*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return i[0]=d*g,i[1]=(a*u-p*o)*g,i[2]=(c*o-a*l)*g,i[3]=f*g,i[4]=(p*r-a*h)*g,i[5]=(a*s-c*r)*g,i[6]=m*g,i[7]=(o*h-u*r)*g,i[8]=(l*r-o*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,o,a){var s=Math.cos(r),l=Math.sin(r);this.set(n*s,n*l,-n*(s*o+l*a)+o+e,-i*l,i*s,-i*(-l*o+s*a)+a+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],o=i[3],a=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*o+n*l,i[6]=t*a+n*c,i[1]=-n*r+t*s,i[4]=-n*o+t*l,i[7]=-n*a+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var zi={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Oi&&(Oi=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Oi.width=e.width,Oi.height=e.height;var n=Oi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Oi}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Bi=0;function ki(e,t,n,i,r,o,a,s,l,c){Object.defineProperty(this,"id",{value:Bi++}),this.uuid=Di.generateUUID(),this.name="",this.image=void 0!==e?e:ki.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:ki.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ti,this.wrapT=void 0!==i?i:ti,this.magFilter=void 0!==r?r:ai,this.minFilter=void 0!==o?o:si,this.anisotropy=void 0!==l?l:1,this.format=void 0!==a?a:mi,this.internalFormat=null,this.type=void 0!==s?s:li,this.offset=new Ni(0,0),this.repeat=new Ni(1,1),this.center=new Ni(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Fi,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Si,this.version=0,this.onUpdate=null}function Hi(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function Ui(e,t,n){this.width=e,this.height=t,this.scissor=new Hi(0,0,e,t),this.scissorTest=!1,this.viewport=new Hi(0,0,e,t),n=n||{},this.texture=new ki(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:ai,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}function Gi(e,t,n){Ui.call(this,e,t,n),this.samples=4}function ji(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}ki.DEFAULT_IMAGE=void 0,ki.DEFAULT_MAPPING=300,ki.prototype=Object.assign(Object.create(Ci.prototype),{constructor:ki,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var 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){var i=this.image;if(void 0===i.uuid&&(i.uuid=Di.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var o=0,a=i.length;o<a;o++)r.push(zi.getDataURL(i[o]))}else r=zi.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ei:e.x=e.x-Math.floor(e.x);break;case ti:e.x=e.x<0?0:1;break;case ni:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ei:e.y=e.y-Math.floor(e.y);break;case ti:e.y=e.y<0?0:1;break;case ni:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(ki.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Hi.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Hi.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,o=.01,a=.1,s=e.elements,l=s[0],c=s[4],h=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-u)<o&&Math.abs(h-f)<o&&Math.abs(d-m)<o){if(Math.abs(c+u)<a&&Math.abs(h+f)<a&&Math.abs(d+m)<a&&Math.abs(l+p+v-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(p+1)/2,x=(v+1)/2,b=(c+u)/4,w=(h+f)/4,_=(d+m)/4;return g>y&&g>x?g<o?(n=0,i=.707106781,r=.707106781):(i=b/(n=Math.sqrt(g)),r=w/n):y>x?y<o?(n=.707106781,i=0,r=.707106781):(n=b/(i=Math.sqrt(y)),r=_/i):x<o?(n=.707106781,i=.707106781,r=0):(n=w/(r=Math.sqrt(x)),i=_/r),this.set(n,i,r,t),this}var M=Math.sqrt((m-d)*(m-d)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(h-f)/M,this.z=(u-c)/M,this.w=Math.acos((l+p+v-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){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:function(){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:function(){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:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),Ui.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Ui,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Gi.prototype=Object.assign(Object.create(Ui.prototype),{constructor:Gi,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Ui.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(ji,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,o,a){var s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=r[o+0],p=r[o+1],d=r[o+2],f=r[o+3];if(h!==f||s!==u||l!==p||c!==d){var m=1-a,v=s*u+l*p+c*d+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,l=l*m+p*w,c=c*m+d*w,h=h*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=_,l*=_,c*=_,h*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h},multiplyQuaternionsFlat:function(e,t,n,i,r,o){var a=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[o],u=r[o+1],p=r[o+2],d=r[o+3];return e[t]=a*d+c*h+s*p-l*u,e[t+1]=s*d+c*u+l*h-a*p,e[t+2]=l*d+c*p+a*u-s*h,e[t+3]=c*d-a*h-s*u-l*p,e}}),Object.defineProperties(ji.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(ji.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,o=e.order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=s(n/2),p=s(i/2),d=s(r/2);switch(o){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],l=n[9],c=n[2],h=n[6],u=n[10],p=i+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-l)*t,this._y=(o-c)*t,this._z=(a-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-l)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+c)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(o-c)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(a-r)/t,this._x=(o+c)/t,this._y=(l+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Di.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+o*a+i*l-r*s,this._y=i*c+o*s+r*a-n*l,this._z=r*c+o*l+n*s-i*a,this._w=o*c-n*a-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var l=1-t;return this._w=l*o+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),h=Math.atan2(c,a),u=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=o*u+this._w*p,this._x=n*u+this._x*p,this._y=i*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Vi=new qi,Wi=new ji;function qi(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(qi.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Wi.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Wi.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*i-a*n,c=s*n+a*t-r*i,h=s*i+r*n-o*t,u=-r*t-o*n-a*i;return this.x=l*s+u*-r+c*-a-h*-o,this.y=c*s+u*-o+h*-r-l*-a,this.z=h*s+u*-a+l*-o-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Vi.copy(this).projectOnVector(e),this.sub(Vi)},reflect:function(e){return this.sub(Vi.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Di.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Xi=new qi,Yi=new er,Qi=new qi(0,0,0),Zi=new qi(1,1,1),Ji=new qi,Ki=new qi,$i=new qi;function er(){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.")}Object.assign(er.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,l,c,h,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=o,v[9]=a,v[13]=s,v[2]=l,v[6]=c,v[10]=h,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new er).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/Xi.setFromMatrixColumn(e,0).length(),r=1/Xi.setFromMatrixColumn(e,1).length(),o=1/Xi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*c,p=o*h,d=a*c,f=a*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=p+d*l,t[5]=u-f*l,t[9]=-a*s,t[2]=f-u*l,t[6]=d+p*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*l,t[1]=o*h,t[5]=o*c,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m-y*a,t[4]=-o*h,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*c,t[9]=y-m*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){u=o*c,p=o*h,d=a*c,f=a*h;t[0]=s*c,t[4]=d*l-p,t[8]=u*l+f,t[1]=s*h,t[5]=f*l+u,t[9]=p*l-d,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var x=o*s,b=o*l,w=a*s,_=a*l;t[0]=s*c,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=o*c,t[9]=-a*c,t[2]=-l*c,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=o*s,b=o*l,w=a*s,_=a*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=x*h+_,t[5]=o*c,t[9]=b*h-w,t[2]=w*h-b,t[6]=a*c,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Qi,e,Zi)},lookAt:function(e,t,n){var i=this.elements;return $i.subVectors(e,t),0===$i.lengthSq()&&($i.z=1),$i.normalize(),Ji.crossVectors(n,$i),0===Ji.lengthSq()&&(1===Math.abs(n.z)?$i.x+=1e-4:$i.z+=1e-4,$i.normalize(),Ji.crossVectors(n,$i)),Ji.normalize(),Ki.crossVectors($i,Ji),i[0]=Ji.x,i[4]=Ki.x,i[8]=$i.x,i[1]=Ji.y,i[5]=Ki.y,i[9]=$i.y,i[2]=Ji.z,i[6]=Ki.z,i[10]=$i.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],E=i[12],S=i[1],A=i[5],T=i[9],P=i[13],L=i[2],C=i[6],I=i[10],R=i[14],O=i[3],D=i[7],N=i[11],F=i[15];return r[0]=o*w+a*S+s*L+l*O,r[4]=o*_+a*A+s*C+l*D,r[8]=o*M+a*T+s*I+l*N,r[12]=o*E+a*P+s*R+l*F,r[1]=c*w+h*S+u*L+p*O,r[5]=c*_+h*A+u*C+p*D,r[9]=c*M+h*T+u*I+p*N,r[13]=c*E+h*P+u*R+p*F,r[2]=d*w+f*S+m*L+v*O,r[6]=d*_+f*A+m*C+v*D,r[10]=d*M+f*T+m*I+v*N,r[14]=d*E+f*P+m*R+v*F,r[3]=g*w+y*S+x*L+b*O,r[7]=g*_+y*A+x*C+b*D,r[11]=g*M+y*T+x*I+b*N,r[15]=g*E+y*P+x*R+b*F,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],s=e[9],l=e[13],c=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(+r*s*h-i*l*h-r*a*u+n*l*u+i*a*p-n*s*p)+e[7]*(+t*s*p-t*l*u+r*o*u-i*o*p+i*l*c-r*s*c)+e[11]*(+t*l*h-t*a*p-r*o*h+n*o*p+r*a*c-n*l*c)+e[15]*(-i*a*c-t*s*h+t*a*u+i*o*h-n*o*u+n*s*c)},transpose:function(){var e,t=this.elements;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:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],o=i[1],a=i[2],s=i[3],l=i[4],c=i[5],h=i[6],u=i[7],p=i[8],d=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],x=i[15],b=d*y*u-g*f*u+g*h*m-c*y*m-d*h*x+c*f*x,w=v*f*u-p*y*u-v*h*m+l*y*m+p*h*x-l*f*x,_=p*g*u-v*d*u+v*c*m-l*g*m-p*c*x+l*d*x,M=v*d*h-p*g*h-v*c*f+l*g*f+p*c*y-l*d*y,E=r*b+o*w+a*_+s*M;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/E;return n[0]=b*S,n[1]=(g*f*s-d*y*s-g*a*m+o*y*m+d*a*x-o*f*x)*S,n[2]=(c*y*s-g*h*s+g*a*u-o*y*u-c*a*x+o*h*x)*S,n[3]=(d*h*s-c*f*s-d*a*u+o*f*u+c*a*m-o*h*m)*S,n[4]=w*S,n[5]=(p*y*s-v*f*s+v*a*m-r*y*m-p*a*x+r*f*x)*S,n[6]=(v*h*s-l*y*s-v*a*u+r*y*u+l*a*x-r*h*x)*S,n[7]=(l*f*s-p*h*s+p*a*u-r*f*u-l*a*m+r*h*m)*S,n[8]=_*S,n[9]=(v*d*s-p*g*s-v*o*m+r*g*m+p*o*x-r*d*x)*S,n[10]=(l*g*s-v*c*s+v*o*u-r*g*u-l*o*x+r*c*x)*S,n[11]=(p*c*s-l*d*s-p*o*u+r*d*u+l*o*m-r*c*m)*S,n[12]=M*S,n[13]=(p*g*a-v*d*a+v*o*f-r*g*f-p*o*y+r*d*y)*S,n[14]=(v*c*a-l*g*a-v*o*h+r*g*h+l*o*y-r*c*y)*S,n[15]=(l*d*a-p*c*a+p*o*h-r*d*h-l*o*f+r*c*f)*S,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,s=e.z,l=r*o,c=r*a;return this.set(l*o+n,l*a-i*s,l*s+i*a,0,l*a+i*s,c*a+n,c*s-i*o,0,l*s-i*a,c*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,o=t._y,a=t._z,s=t._w,l=r+r,c=o+o,h=a+a,u=r*l,p=r*c,d=r*h,f=o*c,m=o*h,v=a*h,g=s*l,y=s*c,x=s*h,b=n.x,w=n.y,_=n.z;return i[0]=(1-(f+v))*b,i[1]=(p+x)*b,i[2]=(d-y)*b,i[3]=0,i[4]=(p-x)*w,i[5]=(1-(u+v))*w,i[6]=(m+g)*w,i[7]=0,i[8]=(d+y)*_,i[9]=(m-g)*_,i[10]=(1-(u+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=Xi.set(i[0],i[1],i[2]).length(),o=Xi.set(i[4],i[5],i[6]).length(),a=Xi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Yi.copy(this);var s=1/r,l=1/o,c=1/a;return Yi.elements[0]*=s,Yi.elements[1]*=s,Yi.elements[2]*=s,Yi.elements[4]*=l,Yi.elements[5]*=l,Yi.elements[6]*=l,Yi.elements[8]*=c,Yi.elements[9]*=c,Yi.elements[10]*=c,t.setFromRotationMatrix(Yi),n.x=r,n.y=o,n.z=a,this},makePerspective:function(e,t,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(o+r)/(o-r),p=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,n,i,r,o){var a=this.elements,s=1/(t-e),l=1/(n-i),c=1/(o-r),h=(t+e)*s,u=(n+i)*l,p=(o+r)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var tr=new er,nr=new ji;function ir(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||ir.DefaultOrder}function rr(){this.mask=1}ir.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ir.DefaultOrder="XYZ",Object.defineProperties(ir.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(ir.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Di.clamp,r=e.elements,o=r[0],a=r[4],s=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return tr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tr,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return nr.setFromEuler(this),this.setFromQuaternion(nr,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new qi(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(rr.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let or=0;const ar=new qi,sr=new ji,lr=new er,cr=new qi,hr=new qi,ur=new qi,pr=new ji,dr=new qi(1,0,0),fr=new qi(0,1,0),mr=new qi(0,0,1),vr={type:"added"},gr={type:"removed"};function yr(){Object.defineProperty(this,"id",{value:or++}),this.uuid=Di.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yr.DefaultUp.clone();var e=new qi,t=new ir,n=new ji,i=new qi(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new er},normalMatrix:{value:new Fi}}),this.matrix=new er,this.matrixWorld=new er,this.matrixAutoUpdate=yr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new rr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function xr(){yr.call(this),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}))}yr.DefaultUp=new qi(0,1,0),yr.DefaultMatrixAutoUpdate=!0,yr.prototype=Object.assign(Object.create(Ci.prototype),{constructor:yr,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return sr.setFromAxisAngle(e,t),this.quaternion.multiply(sr),this},rotateOnWorldAxis:function(e,t){return sr.setFromAxisAngle(e,t),this.quaternion.premultiply(sr),this},rotateX:function(e){return this.rotateOnAxis(dr,e)},rotateY:function(e){return this.rotateOnAxis(fr,e)},rotateZ:function(e){return this.rotateOnAxis(mr,e)},translateOnAxis:function(e,t){return ar.copy(e).applyQuaternion(this.quaternion),this.position.add(ar.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(dr,e)},translateY:function(e){return this.translateOnAxis(fr,e)},translateZ:function(e){return this.translateOnAxis(mr,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(lr.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?cr.copy(e):cr.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),hr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?lr.lookAt(hr,cr,this.up):lr.lookAt(cr,hr,this.up),this.quaternion.setFromRotationMatrix(lr),i&&(lr.extractRotation(i.matrixWorld),sr.setFromRotationMatrix(lr),this.quaternion.premultiply(sr.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(vr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(gr)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),lr.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),lr.multiply(e.parent.matrixWorld)),e.applyMatrix4(lr),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new qi),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new ji),this.updateMatrixWorld(!0),this.matrixWorld.decompose(hr,e,ur),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new qi),this.updateMatrixWorld(!0),this.matrixWorld.decompose(hr,pr,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new qi),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&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===t)for(var i=this.children,r=0,o=i.length;r<o;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),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()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var o=this.geometry.parameters;if(void 0!==o&&void 0!==o.shapes){var a=o.shapes;if(Array.isArray(a))for(var s=0,l=a.length;s<l;s++){var c=a[s];r(e.shapes,c)}else r(e.shapes,a)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,l=this.material.length;s<l;s++)h.push(r(e.materials,this.material[s]));i.material=h}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);a=m(e.shapes);u.length>0&&(n.geometries=u),p.length>0&&(n.materials=p),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),a.length>0&&(n.shapes=a)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),xr.prototype=Object.assign(Object.create(yr.prototype),{constructor:xr,isScene:!0,copy:function(e,t){return yr.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=yr.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var br=[new qi,new qi,new qi,new qi,new qi,new qi,new qi,new qi],wr=new qi,_r=new Or,Mr=new qi,Er=new qi,Sr=new qi,Ar=new qi,Tr=new qi,Pr=new qi,Lr=new qi,Cr=new qi,Ir=new qi,Rr=new qi;function Or(e,t){this.min=void 0!==e?e:new qi(1/0,1/0,1/0),this.max=void 0!==t?t:new qi(-1/0,-1/0,-1/0)}function Dr(e,t,n,i,r){var o,a;for(o=0,a=e.length-3;o<=a;o+=3){Rr.fromArray(e,o);var s=r.x*Math.abs(Rr.x)+r.y*Math.abs(Rr.y)+r.z*Math.abs(Rr.z),l=t.dot(Rr),c=n.dot(Rr),h=i.dot(Rr);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>s)return!1}return!0}Object.assign(Or.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],h=e[s+1],u=e[s+2];c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),h=e.getY(s),u=e.getZ(s);c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=wr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new qi),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new qi),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),_r.copy(t.boundingBox),_r.applyMatrix4(e.matrixWorld),this.union(_r));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new qi),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,wr),wr.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Lr),Cr.subVectors(this.max,Lr),Mr.subVectors(e.a,Lr),Er.subVectors(e.b,Lr),Sr.subVectors(e.c,Lr),Ar.subVectors(Er,Mr),Tr.subVectors(Sr,Er),Pr.subVectors(Mr,Sr);var t=[0,-Ar.z,Ar.y,0,-Tr.z,Tr.y,0,-Pr.z,Pr.y,Ar.z,0,-Ar.x,Tr.z,0,-Tr.x,Pr.z,0,-Pr.x,-Ar.y,Ar.x,0,-Tr.y,Tr.x,0,-Pr.y,Pr.x,0];return!!Dr(t,Mr,Er,Sr,Cr)&&(!!Dr(t=[1,0,0,0,1,0,0,0,1],Mr,Er,Sr,Cr)&&(Ir.crossVectors(Ar,Tr),Dr(t=[Ir.x,Ir.y,Ir.z],Mr,Er,Sr,Cr)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new qi),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return wr.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(wr).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(br[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),br[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),br[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),br[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),br[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),br[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),br[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),br[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(br)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Nr=new Or;function Fr(e,t){this.center=void 0!==e?e:new qi,this.radius=void 0!==t?t:-1}Object.assign(Fr.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):Nr.setFromPoints(e).getCenter(n);for(var i=0,r=0,o=e.length;r<o;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new qi),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Or),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var zr=new qi,Br=new qi,kr=new qi,Hr=new qi,Ur=new qi,Gr=new qi,jr=new qi;function Vr(e,t){this.origin=void 0!==e?e:new qi,this.direction=void 0!==t?t:new qi(0,0,-1)}Object.assign(Vr.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new qi),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,zr)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new qi),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=zr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(zr.copy(this.direction).multiplyScalar(t).add(this.origin),zr.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){Br.copy(e).add(t).multiplyScalar(.5),kr.copy(t).sub(e).normalize(),Hr.copy(this.origin).sub(Br);var r,o,a,s,l=.5*e.distanceTo(t),c=-this.direction.dot(kr),h=Hr.dot(this.direction),u=-Hr.dot(kr),p=Hr.lengthSq(),d=Math.abs(1-c*c);if(d>0)if(o=c*h-u,s=l*d,(r=c*u-h)>=0)if(o>=-s)if(o<=s){var f=1/d;a=(r*=f)*(r+c*(o*=f)+2*h)+o*(c*r+o+2*u)+p}else o=l,a=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+p;else o=-l,a=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+p;else o<=-s?a=-(r=Math.max(0,-(-c*l+h)))*r+(o=r>0?-l:Math.min(Math.max(-l,-u),l))*(o+2*u)+p:o<=s?(r=0,a=(o=Math.min(Math.max(-l,-u),l))*(o+2*u)+p):a=-(r=Math.max(0,-(c*l+h)))*r+(o=r>0?l:Math.min(Math.max(-l,-u),l))*(o+2*u)+p;else o=c>0?-l:l,a=-(r=Math.max(0,-(c*o+h)))*r+o*(o+2*u)+p;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(kr).multiplyScalar(o).add(Br),a},intersectSphere:function(e,t){zr.subVectors(e.center,this.origin);var n=zr.dot(this.direction),i=zr.dot(zr)-n*n,r=e.radius*e.radius;if(i>r)return null;var o=Math.sqrt(r-i),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,t):this.at(a,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),h>=0?(a=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(a=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,zr)},intersectTriangle:function(e,t,n,i,r){Ur.subVectors(t,e),Gr.subVectors(n,e),jr.crossVectors(Ur,Gr);var o,a=this.direction.dot(jr);if(a>0){if(i)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Hr.subVectors(this.origin,e);var s=o*this.direction.dot(Gr.crossVectors(Hr,Gr));if(s<0)return null;var l=o*this.direction.dot(Ur.cross(Hr));if(l<0)return null;if(s+l>a)return null;var c=-o*Hr.dot(jr);return c<0?null:this.at(c/a,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Wr=new qi,qr=new qi,Xr=new Fi;function Yr(e,t){this.normal=void 0!==e?e:new qi(1,0,0),this.constant=void 0!==t?t:0}Object.assign(Yr.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=Wr.subVectors(n,t).cross(qr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new qi),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new qi);var n=e.delta(Wr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new qi),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Xr.getNormalMatrix(e),i=this.coplanarPoint(Wr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Qr=new qi,Zr=new qi,Jr=new qi,Kr=new qi,$r=new qi,eo=new qi,to=new qi,no=new qi,io=new qi,ro=new qi;function oo(e,t,n){this.a=void 0!==e?e:new qi,this.b=void 0!==t?t:new qi,this.c=void 0!==n?n:new qi}Object.assign(oo,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new qi),i.subVectors(n,t),Qr.subVectors(e,t),i.cross(Qr);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){Qr.subVectors(i,t),Zr.subVectors(n,t),Jr.subVectors(e,t);var o=Qr.dot(Qr),a=Qr.dot(Zr),s=Qr.dot(Jr),l=Zr.dot(Zr),c=Zr.dot(Jr),h=o*l-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new qi),0===h)return r.set(-2,-1,-1);var u=1/h,p=(l*s-a*c)*u,d=(o*c-a*s)*u;return r.set(1-p-d,d,p)},containsPoint:function(e,t,n,i){return oo.getBarycoord(e,t,n,i,Kr),Kr.x>=0&&Kr.y>=0&&Kr.x+Kr.y<=1},getUV:function(e,t,n,i,r,o,a,s){return this.getBarycoord(e,t,n,i,Kr),s.set(0,0),s.addScaledVector(r,Kr.x),s.addScaledVector(o,Kr.y),s.addScaledVector(a,Kr.z),s},isFrontFacing:function(e,t,n,i){return Qr.subVectors(n,t),Zr.subVectors(e,t),Qr.cross(Zr).dot(i)<0}}),Object.assign(oo.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Qr.subVectors(this.c,this.b),Zr.subVectors(this.a,this.b),.5*Qr.cross(Zr).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new qi),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return oo.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Yr),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return oo.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return oo.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return oo.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return oo.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new qi);var n,i,r=this.a,o=this.b,a=this.c;$r.subVectors(o,r),eo.subVectors(a,r),no.subVectors(e,r);var s=$r.dot(no),l=eo.dot(no);if(s<=0&&l<=0)return t.copy(r);io.subVectors(e,o);var c=$r.dot(io),h=eo.dot(io);if(c>=0&&h<=c)return t.copy(o);var u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(r).addScaledVector($r,n);ro.subVectors(e,a);var p=$r.dot(ro),d=eo.dot(ro);if(d>=0&&p<=d)return t.copy(a);var f=p*l-s*d;if(f<=0&&l>=0&&d<=0)return i=l/(l-d),t.copy(r).addScaledVector(eo,i);var m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return to.subVectors(a,o),i=(h-c)/(h-c+(p-d)),t.copy(o).addScaledVector(to,i);var v=1/(m+f+u);return n=f*v,i=u*v,t.copy(r).addScaledVector($r,n).addScaledVector(eo,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var ao={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},so={h:0,s:0,l:0},lo={h:0,s:0,l:0};function co(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function ho(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function uo(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function po(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function fo(e,t,n,i,r,o){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new qi,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new co,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}Object.assign(co.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Di.euclideanModulo(e,1),t=Di.clamp(t,0,1),n=Di.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=ho(r,i,e+1/3),this.g=ho(r,i,e),this.b=ho(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=ao[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=uo(e.r),this.g=uo(e.g),this.b=uo(e.b),this},copyLinearToSRGB:function(e){return this.r=po(e.r),this.g=po(e.g),this.b=po(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,o=this.b,a=Math.max(i,r,o),s=Math.min(i,r,o),l=(s+a)/2;if(s===a)t=0,n=0;else{var c=a-s;switch(n=l<=.5?c/(a+s):c/(2-a-s),a){case i:t=(r-o)/c+(r<o?6:0);break;case r:t=(o-i)/c+2;break;case o:t=(i-r)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(so),so.h+=e,so.s+=t,so.l+=n,this.setHSL(so.h,so.s,so.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(so),e.getHSL(lo);var n=Di.lerp(so.h,lo.h,t),i=Di.lerp(so.s,lo.s,t),r=Di.lerp(so.l,lo.l,t);return this.setHSL(n,i,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),co.NAMES=ao,Object.assign(fo.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var mo=0;function vo(){Object.defineProperty(this,"id",{value:mo++}),this.uuid=Di.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Kn,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=Ti,this.stencilZFail=Ti,this.stencilZPass=Ti,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function go(e){vo.call(this),this.type="MeshBasicMaterial",this.color=new co(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.skinning=!1,this.morphTargets=!1,this.setValues(e)}vo.prototype=Object.assign(Object.create(Ci.prototype),{constructor:vo,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}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.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.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.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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,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.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.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(vo.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),go.prototype=Object.create(vo.prototype),go.prototype.constructor=go,go.prototype.isMeshBasicMaterial=!0,go.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var yo=new qi;function xo(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=Pi,this.updateRange={offset:0,count:-1},this.version=0}function bo(e,t,n){xo.call(this,new Int8Array(e),t,n)}function wo(e,t,n){xo.call(this,new Uint8Array(e),t,n)}function _o(e,t,n){xo.call(this,new Uint8ClampedArray(e),t,n)}function Mo(e,t,n){xo.call(this,new Int16Array(e),t,n)}function Eo(e,t,n){xo.call(this,new Uint16Array(e),t,n)}function So(e,t,n){xo.call(this,new Int32Array(e),t,n)}function Ao(e,t,n){xo.call(this,new Uint32Array(e),t,n)}function To(e,t,n){xo.call(this,new Float32Array(e),t,n)}function Po(e,t,n){xo.call(this,new Float64Array(e),t,n)}function Lo(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Co(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(xo.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(xo.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new co),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new Ni),t[n++]=o.x,t[n++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new qi),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new Hi),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)yo.x=this.getX(t),yo.y=this.getY(t),yo.z=this.getZ(t),yo.applyMatrix3(e),this.setXYZ(t,yo.x,yo.y,yo.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)yo.x=this.getX(t),yo.y=this.getY(t),yo.z=this.getZ(t),yo.applyMatrix4(e),this.setXYZ(t,yo.x,yo.y,yo.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)yo.x=this.getX(t),yo.y=this.getY(t),yo.z=this.getZ(t),yo.applyNormalMatrix(e),this.setXYZ(t,yo.x,yo.y,yo.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)yo.x=this.getX(t),yo.y=this.getY(t),yo.z=this.getZ(t),yo.transformDirection(e),this.setXYZ(t,yo.x,yo.y,yo.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),bo.prototype=Object.create(xo.prototype),bo.prototype.constructor=bo,wo.prototype=Object.create(xo.prototype),wo.prototype.constructor=wo,_o.prototype=Object.create(xo.prototype),_o.prototype.constructor=_o,Mo.prototype=Object.create(xo.prototype),Mo.prototype.constructor=Mo,Eo.prototype=Object.create(xo.prototype),Eo.prototype.constructor=Eo,So.prototype=Object.create(xo.prototype),So.prototype.constructor=So,Ao.prototype=Object.create(xo.prototype),Ao.prototype.constructor=Ao,To.prototype=Object.create(xo.prototype),To.prototype.constructor=To,Po.prototype=Object.create(xo.prototype),Po.prototype.constructor=Po,Object.assign(Lo.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,n.push(t)),t={start:3*o,materialIndex:i})}void 0!==t&&(t.count=3*o-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,o=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(p>0){h=[];for(c=0;c<p;c++)h[c]={name:u[c].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===i.length,v=f.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var g=n[c];this.vertices.push(i[g.a],i[g.b],i[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}if(!0===o)void 0!==(b=r[0][c])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new Ni,new Ni,new Ni));if(!0===a)void 0!==(b=r[1][c])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new Ni,new Ni,new Ni));for(var M=0;M<l;M++){var E=s[M].vertices;t[M].data.push(E[g.a],E[g.b],E[g.c])}for(M=0;M<p;M++){var S=u[M].vertexNormals[c];h[M].data.push(S.a,S.b,S.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var Io=1,Ro=new er,Oo=new yr,Do=new qi,No=new Or,Fo=new Or,zo=new qi;function Bo(){Object.defineProperty(this,"id",{value:Io+=2}),this.uuid=Di.generateUUID(),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={}}Bo.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Bo,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Co(e)>65535?Ao:Eo)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new Fi).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Ro.makeRotationX(e),this.applyMatrix4(Ro),this},rotateY:function(e){return Ro.makeRotationY(e),this.applyMatrix4(Ro),this},rotateZ:function(e){return Ro.makeRotationZ(e),this.applyMatrix4(Ro),this},translate:function(e,t,n){return Ro.makeTranslation(e,t,n),this.applyMatrix4(Ro),this},scale:function(e,t,n){return Ro.makeScale(e,t,n),this.applyMatrix4(Ro),this},lookAt:function(e){return Oo.lookAt(e),Oo.updateMatrix(),this.applyMatrix4(Oo.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Do).negate(),this.translate(Do.x,Do.y,Do.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new To(3*t.vertices.length,3),i=new To(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new To(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new To(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Lo).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new xo(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new xo(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new xo(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new xo(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new xo(o,2).copyVector2sArray(e.uvs2))}for(var a in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[a],c=0,h=l.length;c<h;c++){var u=l[c],p=new To(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[a]=s}if(e.skinIndices.length>0){var d=new To(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new To(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Or);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];No.setFromBufferAttribute(r),this.morphTargetsRelative?(zo.addVectors(this.boundingBox.min,No.min),this.boundingBox.expandByPoint(zo),zo.addVectors(this.boundingBox.max,No.max),this.boundingBox.expandByPoint(zo)):(this.boundingBox.expandByPoint(No.min),this.boundingBox.expandByPoint(No.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:function(){null===this.boundingSphere&&(this.boundingSphere=new Fr);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(No.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var o=t[i];Fo.setFromBufferAttribute(o),this.morphTargetsRelative?(zo.addVectors(No.min,Fo.min),No.expandByPoint(zo),zo.addVectors(No.max,Fo.max),No.expandByPoint(zo)):(No.expandByPoint(Fo.min),No.expandByPoint(Fo.max))}No.getCenter(n);var a=0;for(i=0,r=e.count;i<r;i++)zo.fromBufferAttribute(e,i),a=Math.max(a,n.distanceToSquared(zo));if(t)for(i=0,r=t.length;i<r;i++){o=t[i];for(var s=this.morphTargetsRelative,l=0,c=o.count;l<c;l++)zo.fromBufferAttribute(o,l),s&&(Do.fromBufferAttribute(e,l),zo.add(Do)),a=Math.max(a,n.distanceToSquared(zo))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new xo(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,o=i.length;r<o;r++)i[r]=0;var a,s,l,c=t.normal.array,h=new qi,u=new qi,p=new qi,d=new qi,f=new qi;if(e){var m=e.array;for(r=0,o=e.count;r<o;r+=3)a=3*m[r+0],s=3*m[r+1],l=3*m[r+2],h.fromArray(n,a),u.fromArray(n,s),p.fromArray(n,l),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[a]+=d.x,c[a+1]+=d.y,c[a+2]+=d.z,c[s]+=d.x,c[s+1]+=d.y,c[s+2]+=d.z,c[l]+=d.x,c[l+1]+=d.y,c[l+2]+=d.z}else for(r=0,o=n.length;r<o;r+=9)h.fromArray(n,r),u.fromArray(n,r+3),p.fromArray(n,r+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[r]=d.x,c[r+1]=d.y,c[r+2]=d.z,c[r+3]=d.x,c[r+4]=d.y,c[r+5]=d.z,c[r+6]=d.x,c[r+7]=d.y,c[r+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,o=e.attributes[i],a=o.array,s=o.itemSize*t,l=Math.min(a.length,r.length-s),c=0,h=s;c<l;c++,h++)r[h]=a[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)zo.x=e.getX(t),zo.y=e.getY(t),zo.z=e.getZ(t),zo.normalize(),e.setXYZ(t,zo.x,zo.y,zo.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,o=new n.constructor(t.length*i),a=0,s=0,l=0,c=t.length;l<c;l++){a=t[l]*i;for(var h=0;h<i;h++)o[s++]=n[a++]}return new xo(o,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Bo,n=this.index.array,i=this.attributes;for(var r in i){var o=e(i[r],n);t.setAttribute(r,o)}var a=this.morphAttributes;for(r in a){for(var s=[],l=a[r],c=0,h=l.length;c<h;c++){o=e(l[c],n);s.push(o)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,p=(c=0,u.length);c<p;c++){var d=u[c];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var o=(p=r[n]).toJSON();""!==p.name&&(o.name=p.name),e.data.attributes[n]=o}var a={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],h=0,u=l.length;h<u;h++){var p;o=(p=l[h]).toJSON();""!==p.name&&(o.name=p.name),c.push(o)}c.length>0&&(a[n]=c,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Bo).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.setAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;n<i;n++)l.push(c[n].clone());this.morphAttributes[t]=l}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(n=0,i=h.length;n<i;n++){var u=h[n];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var ko=new er,Ho=new Vr,Uo=new Fr,Go=new qi,jo=new qi,Vo=new qi,Wo=new qi,qo=new qi,Xo=new qi,Yo=new qi,Qo=new qi,Zo=new qi,Jo=new Ni,Ko=new Ni,$o=new Ni,ea=new qi,ta=new qi;function na(e,t){yr.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Bo,this.material=void 0!==t?t:new go,this.updateMorphTargets()}function ia(e,t,n,i,r,o,a,s){if(null===(1===t.side?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,2!==t.side,s)))return null;ta.copy(s),ta.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(ta);return l<n.near||l>n.far?null:{distance:l,point:ta.clone(),object:e}}function ra(e,t,n,i,r,o,a,s,l,c,h,u){Go.fromBufferAttribute(r,c),jo.fromBufferAttribute(r,h),Vo.fromBufferAttribute(r,u);var p=e.morphTargetInfluences;if(t.morphTargets&&o&&p){Yo.set(0,0,0),Qo.set(0,0,0),Zo.set(0,0,0);for(var d=0,f=o.length;d<f;d++){var m=p[d],v=o[d];0!==m&&(Wo.fromBufferAttribute(v,c),qo.fromBufferAttribute(v,h),Xo.fromBufferAttribute(v,u),a?(Yo.addScaledVector(Wo,m),Qo.addScaledVector(qo,m),Zo.addScaledVector(Xo,m)):(Yo.addScaledVector(Wo.sub(Go),m),Qo.addScaledVector(qo.sub(jo),m),Zo.addScaledVector(Xo.sub(Vo),m)))}Go.add(Yo),jo.add(Qo),Vo.add(Zo)}e.isSkinnedMesh&&(e.boneTransform(c,Go),e.boneTransform(h,jo),e.boneTransform(u,Vo));var g=ia(e,t,n,i,Go,jo,Vo,ea);if(g){s&&(Jo.fromBufferAttribute(s,c),Ko.fromBufferAttribute(s,h),$o.fromBufferAttribute(s,u),g.uv=oo.getUV(ea,Go,jo,Vo,Jo,Ko,$o,new Ni)),l&&(Jo.fromBufferAttribute(l,c),Ko.fromBufferAttribute(l,h),$o.fromBufferAttribute(l,u),g.uv2=oo.getUV(ea,Go,jo,Vo,Jo,Ko,$o,new Ni));var y=new fo(c,h,u);oo.getNormal(Go,jo,Vo,y.normal),g.face=y}return g}na.prototype=Object.assign(Object.create(yr.prototype),{constructor:na,isMesh:!0,copy:function(e){return yr.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,o=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Uo.copy(i.boundingSphere),Uo.applyMatrix4(o),!1!==e.ray.intersectsSphere(Uo)&&(ko.getInverse(o),Ho.copy(e.ray).applyMatrix4(ko),null===i.boundingBox||!1!==Ho.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var a,s,l,c,h,u,p,d,f,m=i.index,v=i.attributes.position,g=i.morphAttributes.position,y=i.morphTargetsRelative,x=i.attributes.uv,b=i.attributes.uv2,w=i.groups,_=i.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)a=m.getX(h),s=m.getX(h+1),l=m.getX(h+2),(n=ra(this,f,e,Ho,v,g,y,x,b,a,s,l))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(m.count,_.start+_.count);c<u;c+=3)a=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(n=ra(this,r,e,Ho,v,g,y,x,b,a,s,l))&&(n.faceIndex=Math.floor(c/3),t.push(n));else if(void 0!==v)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)(n=ra(this,f,e,Ho,v,g,y,x,b,a=h,s=h+1,l=h+2))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(v.count,_.start+_.count);c<u;c+=3)(n=ra(this,r,e,Ho,v,g,y,x,b,a=c,s=c+1,l=c+2))&&(n.faceIndex=Math.floor(c/3),t.push(n))}else if(i.isGeometry){var M,E,S,A,T=Array.isArray(r),P=i.vertices,L=i.faces,C=i.faceVertexUvs[0];C.length>0&&(A=C);for(var I=0,R=L.length;I<R;I++){var O=L[I],D=T?r[O.materialIndex]:r;if(void 0!==D&&(M=P[O.a],E=P[O.b],S=P[O.c],n=ia(this,D,e,Ho,M,E,S,ea))){if(A&&A[I]){var N=A[I];Jo.copy(N[0]),Ko.copy(N[1]),$o.copy(N[2]),n.uv=oo.getUV(ea,M,E,S,Jo,Ko,$o,new Ni)}n.face=O,n.faceIndex=I,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var oa=0,aa=new er,sa=new yr,la=new qi;function ca(){Object.defineProperty(this,"id",{value:oa+=2}),this.uuid=Di.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}ca.prototype=Object.assign(Object.create(Ci.prototype),{constructor:ca,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Fi).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(e)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return aa.makeRotationX(e),this.applyMatrix4(aa),this},rotateY:function(e){return aa.makeRotationY(e),this.applyMatrix4(aa),this},rotateZ:function(e){return aa.makeRotationZ(e),this.applyMatrix4(aa),this},translate:function(e,t,n){return aa.makeTranslation(e,t,n),this.applyMatrix4(aa),this},scale:function(e,t,n){return aa.makeScale(e,t,n),this.applyMatrix4(aa),this},lookAt:function(e){return sa.lookAt(e),sa.updateMatrix(),this.applyMatrix4(sa.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,i=e.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position.array,o=void 0!==i.normal?i.normal.array:void 0,a=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,l=void 0!==i.uv2?i.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<r.length;c+=3)t.vertices.push((new qi).fromArray(r,c)),void 0!==a&&t.colors.push((new co).fromArray(a,c));function h(e,n,i,r){var c=void 0===a?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()],h=new fo(e,n,i,void 0===o?[]:[(new qi).fromArray(o,3*e),(new qi).fromArray(o,3*n),(new qi).fromArray(o,3*i)],c,r);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new Ni).fromArray(s,2*e),(new Ni).fromArray(s,2*n),(new Ni).fromArray(s,2*i)]),void 0!==l&&t.faceVertexUvs[1].push([(new Ni).fromArray(l,2*e),(new Ni).fromArray(l,2*n),(new Ni).fromArray(l,2*i)])}var u=e.groups;if(u.length>0)for(c=0;c<u.length;c++)for(var p=u[c],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==n?h(n[f],n[f+1],n[f+2],p.materialIndex):h(f,f+1,f+2,p.materialIndex);else if(void 0!==n)for(c=0;c<n.length;c+=3)h(n[c],n[c+1],n[c+2]);else for(c=0;c<r.length/3;c+=3)h(c,c+1,c+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(la).negate(),this.translate(la.x,la.y,la.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new er;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new qi,t=new qi,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],o=this.vertices[r.a],a=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,a),t.subVectors(o,a),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,o,a;for(void 0===e&&(e=!0),a=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)a[t]=new qi;if(e){var s,l,c,h=new qi,u=new qi;for(i=0,r=this.faces.length;i<r;i++)o=this.faces[i],s=this.vertices[o.a],l=this.vertices[o.b],c=this.vertices[o.c],h.subVectors(c,l),u.subVectors(s,l),h.cross(u),a[o.a].add(h),a[o.b].add(h),a[o.c].add(h)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)a[(o=this.faces[i]).a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(t=0,n=this.vertices.length;t<n;t++)a[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var p=(o=this.faces[i]).vertexNormals;3===p.length?(p[0].copy(a[o.a]),p[1].copy(a[o.b]),p[2].copy(a[o.c])):(p[0]=a[o.a].clone(),p[1]=a[o.b].clone(),p[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var o=new ca;for(o.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var a=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)l=new qi,c={a:new qi,b:new qi,c:new qi},a.push(l),s.push(c)}var l,c,h=this.morphNormals[e];for(o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],l=h.faceNormals[n],c=h.vertexNormals[n],l.copy(r.normal),c.a.copy(r.vertexNormals[0]),c.b.copy(r.vertexNormals[1]),c.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Or),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Fr),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,l=e.faces,c=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new Fi).getNormalMatrix(t));for(var u=0,p=a.length;u<p;u++){var d=a[u].clone();void 0!==t&&d.applyMatrix4(t),o.push(d)}for(u=0,p=h.length;u<p;u++)c.push(h[u].clone());for(u=0,p=l.length;u<p;u++){var f,m,v,g=l[u],y=g.vertexNormals,x=g.vertexColors;(f=new fo(g.a+r,g.b+r,g.c+r)).normal.copy(g.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(b=0,w=x.length;b<w;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(u=0,p=e.faceVertexUvs.length;u<p;u++){var _=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],E=[],S=0,A=M.length;S<A;S++)E.push(M[S].clone());this.faceVertexUvs[u].push(E)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,o,a,s,l={},c=[],h=[],u=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(l[t]=n,c.push(this.vertices[n]),h[n]=c.length-1):h[n]=h[l[t]];var p=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],o=[r.a,r.b,r.c];for(var d=0;d<3;d++)if(o[d]===o[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new qi(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,r,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];o&&o.length===t&&(i=[]),a&&a.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(o[s]),r&&r.push(a[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var o=this.vertices[r];i.push(o.x,o.y,o.z)}var a=[],s=[],l={},c=[],h={},u=[],p={};for(r=0;r<this.faces.length;r++){var d=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,v),x=M(x,6,g),x=M(x,7,y),a.push(x),a.push(d.a,d.b,d.c),a.push(d.materialIndex),f){var b=this.faceVertexUvs[0][r];a.push(A(b[0]),A(b[1]),A(b[2]))}if(m&&a.push(E(d.normal)),v){var w=d.vertexNormals;a.push(E(w[0]),E(w[1]),E(w[2]))}if(g&&a.push(S(d.color)),y){var _=d.vertexColors;a.push(S(_[0]),S(_[1]),S(_[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function S(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=c.length,c.push(e.getHex())),h[t]}function A(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=i,e.data.normals=s,c.length>0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=a,e},clone:function(){return(new ca).copy(this)},copy:function(e){var t,n,i,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=h.length;i<r;i++){var u=h[i],p=[];for(o=0,a=u.length;o<a;o++){var d=u[o];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],i=0,r=f[t].vertices.length;i<r;i++)m.vertices.push(f[t].vertices[i].clone());if(void 0!==f[t].normals)for(m.normals=[],i=0,r=f[t].normals.length;i<r;i++)m.normals.push(f[t].normals[i].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],i=0,r=v[t].vertexNormals.length;i<r;i++){var y=v[t].vertexNormals[i],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],i=0,r=v[t].faceNormals.length;i<r;i++)g.faceNormals.push(v[t].faceNormals[i].clone());this.morphNormals.push(g)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=e.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class ha extends Bo{constructor(e,t,n,i,r,o){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;const s=[],l=[],c=[],h=[];let u=0,p=0;function d(e,t,n,i,r,o,d,f,m,v,g){const y=o/m,x=d/v,b=o/2,w=d/2,_=f/2,M=m+1,E=v+1;let S=0,A=0;const T=new qi;for(let a=0;a<E;a++){const o=a*x-w;for(let s=0;s<M;s++){const u=s*y-b;T[e]=u*i,T[t]=o*r,T[n]=_,l.push(T.x,T.y,T.z),T[e]=0,T[t]=0,T[n]=f>0?1:-1,c.push(T.x,T.y,T.z),h.push(s/m),h.push(1-a/v),S+=1}}for(let a=0;a<v;a++)for(let e=0;e<m;e++){const t=u+e+M*a,n=u+e+M*(a+1),i=u+(e+1)+M*(a+1),r=u+(e+1)+M*a;s.push(t,n,r),s.push(n,i,r),A+=6}a.addGroup(p,A,g),p+=A,u+=S}d("z","y","x",-1,-1,n,t,e,o,r,0),d("z","y","x",1,-1,n,t,-e,o,r,1),d("x","z","y",1,1,e,n,t,i,o,2),d("x","z","y",1,-1,e,n,-t,i,o,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new To(l,3)),this.setAttribute("normal",new To(c,3)),this.setAttribute("uv",new To(h,2))}}function ua(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function pa(e){for(var t={},n=0;n<e.length;n++){var i=ua(e[n]);for(var r in i)t[r]=i[r]}return t}var da={clone:ua,merge:pa};function fa(e){vo.call(this),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.skinning=!1,this.morphTargets=!1,this.morphNormals=!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,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function ma(){yr.call(this),this.type="Camera",this.matrixWorldInverse=new er,this.projectionMatrix=new er,this.projectionMatrixInverse=new er}function va(e,t,n,i){ma.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}fa.prototype=Object.create(vo.prototype),fa.prototype.constructor=fa,fa.prototype.isShaderMaterial=!0,fa.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ua(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},fa.prototype.toJSON=function(e){var t=vo.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var o in this.extensions)!0===this.extensions[o]&&(r[o]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},ma.prototype=Object.assign(Object.create(yr.prototype),{constructor:ma,isCamera:!0,copy:function(e,t){return yr.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new qi),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){yr.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){yr.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),va.prototype=Object.assign(Object.create(ma.prototype),{constructor:va,isPerspectiveCamera:!0,copy:function(e,t){return ma.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Di.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Di.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Di.RAD2DEG*Math.atan(Math.tan(.5*Di.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Di.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,t-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=yr.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var ga=90;function ya(e,t,n){if(yr.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var i=new va(ga,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new qi(1,0,0)),this.add(i);var r=new va(ga,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new qi(-1,0,0)),this.add(r);var o=new va(ga,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new qi(0,1,0)),this.add(o);var a=new va(ga,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new qi(0,-1,0)),this.add(a);var s=new va(ga,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new qi(0,0,1)),this.add(s);var l=new va(ga,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new qi(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;var u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c},this.clear=function(e,t,i,r){for(var o=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(n,a),e.clear(t,i,r);e.setRenderTarget(o)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function xa(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Ui.call(this,e,e,t)}function ba(e,t,n,i,r,o,a,s,l,c,h,u){ki.call(this,null,o,a,s,l,c,i,r,h,u),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:ii,this.minFilter=void 0!==c?c:ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}ya.prototype=Object.create(yr.prototype),ya.prototype.constructor=ya,xa.prototype=Object.create(Ui.prototype),xa.prototype.constructor=xa,xa.prototype.isWebGLCubeRenderTarget=!0,xa.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new xr,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new fa({type:"CubemapFromEquirect",uniforms:ua(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;var o=new na(new ha(5,5,5),r);return n.add(o),new ya(1,10,this).update(e,n),o.geometry.dispose(),o.material.dispose(),this},ba.prototype=Object.create(ki.prototype),ba.prototype.constructor=ba,ba.prototype.isDataTexture=!0;var wa=new Fr,_a=new qi;function Ma(e,t,n,i,r,o){this.planes=[void 0!==e?e:new Yr,void 0!==t?t:new Yr,void 0!==n?n:new Yr,void 0!==i?i:new Yr,void 0!==r?r:new Yr,void 0!==o?o:new Yr]}Object.assign(Ma.prototype,{set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-i,h-s,f-u,y-m).normalize(),t[1].setComponents(a+i,h+s,f+u,y+m).normalize(),t[2].setComponents(a+r,h+l,f+p,y+v).normalize(),t[3].setComponents(a-r,h-l,f-p,y-v).normalize(),t[4].setComponents(a-o,h-c,f-d,y-g).normalize(),t[5].setComponents(a+o,h+c,f+d,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),wa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)},intersectsSprite:function(e){return wa.center.set(0,0,0),wa.radius=.7071067811865476,wa.applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(_a.x=i.normal.x>0?e.max.x:e.min.x,_a.y=i.normal.y>0?e.max.y:e.min.y,_a.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(_a)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Ea={common:{diffuse:{value:new co(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Fi},uv2Transform:{value:new Fi},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},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 Ni(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 co(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new co(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Fi}},sprite:{diffuse:{value:new co(15658734)},opacity:{value:1},center:{value:new Ni(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Fi}}};function Sa(){var e=null,t=!1,n=null;function i(r,o){!1!==t&&(n(r,o),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Aa(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var o=i.get(t);void 0===o?i.set(t,function(t,n){var i=t.array,r=t.usage,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback();var a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,r)):o.version<t.version&&(!function(t,i,r){var o=i.array,a=i.updateRange;e.bindBuffer(r,t),-1===a.count?e.bufferSubData(r,0,o):(n?e.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):e.bufferSubData(r,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,t,r),o.version=t.version)}}}function Ta(e,t,n,i){ca.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new Pa(e,t,n,i)),this.mergeVertices()}function Pa(e,t,n,i){Bo.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,o,a=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(i)||1,h=l+1,u=c+1,p=e/l,d=t/c,f=[],m=[],v=[],g=[];for(o=0;o<u;o++){var y=o*d-s;for(r=0;r<h;r++){var x=r*p-a;m.push(x,-y,0),v.push(0,0,1),g.push(r/l),g.push(1-o/c)}}for(o=0;o<c;o++)for(r=0;r<l;r++){var b=r+h*o,w=r+h*(o+1),_=r+1+h*(o+1),M=r+1+h*o;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new To(m,3)),this.setAttribute("normal",new To(v,3)),this.setAttribute("uv",new To(g,2))}Ta.prototype=Object.create(ca.prototype),Ta.prototype.constructor=Ta,Pa.prototype=Object.create(Bo.prototype),Pa.prototype.constructor=Pa;var La={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 ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\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.specularRoughness );\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:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_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_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, 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 dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * 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}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_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 dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\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);\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_Specular_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 ) {\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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 return 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#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\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\t\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#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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 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\tgetPointDirectLightIrradiance( 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\tgetSpotDirectLightIrradiance( 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\tgetDirectionalDirectLightIrradiance( 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 += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\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\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\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 ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef 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 );\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",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#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#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#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#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#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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\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\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\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\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\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\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\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;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",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 )\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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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 <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\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\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 <worldpos_vertex>\n\t#include <clipping_planes_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 <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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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 <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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\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 <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 <lights_toon_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_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 + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\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 <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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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 <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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\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 REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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 <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 <lights_physical_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#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\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 <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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <packing>\n#include <uv_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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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 <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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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 <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 <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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},Ca={basic:{uniforms:pa([Ea.common,Ea.specularmap,Ea.envmap,Ea.aomap,Ea.lightmap,Ea.fog]),vertexShader:La.meshbasic_vert,fragmentShader:La.meshbasic_frag},lambert:{uniforms:pa([Ea.common,Ea.specularmap,Ea.envmap,Ea.aomap,Ea.lightmap,Ea.emissivemap,Ea.fog,Ea.lights,{emissive:{value:new co(0)}}]),vertexShader:La.meshlambert_vert,fragmentShader:La.meshlambert_frag},phong:{uniforms:pa([Ea.common,Ea.specularmap,Ea.envmap,Ea.aomap,Ea.lightmap,Ea.emissivemap,Ea.bumpmap,Ea.normalmap,Ea.displacementmap,Ea.fog,Ea.lights,{emissive:{value:new co(0)},specular:{value:new co(1118481)},shininess:{value:30}}]),vertexShader:La.meshphong_vert,fragmentShader:La.meshphong_frag},standard:{uniforms:pa([Ea.common,Ea.envmap,Ea.aomap,Ea.lightmap,Ea.emissivemap,Ea.bumpmap,Ea.normalmap,Ea.displacementmap,Ea.roughnessmap,Ea.metalnessmap,Ea.fog,Ea.lights,{emissive:{value:new co(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:La.meshphysical_vert,fragmentShader:La.meshphysical_frag},toon:{uniforms:pa([Ea.common,Ea.specularmap,Ea.aomap,Ea.lightmap,Ea.emissivemap,Ea.bumpmap,Ea.normalmap,Ea.displacementmap,Ea.gradientmap,Ea.fog,Ea.lights,{emissive:{value:new co(0)},specular:{value:new co(1118481)},shininess:{value:30}}]),vertexShader:La.meshtoon_vert,fragmentShader:La.meshtoon_frag},matcap:{uniforms:pa([Ea.common,Ea.bumpmap,Ea.normalmap,Ea.displacementmap,Ea.fog,{matcap:{value:null}}]),vertexShader:La.meshmatcap_vert,fragmentShader:La.meshmatcap_frag},points:{uniforms:pa([Ea.points,Ea.fog]),vertexShader:La.points_vert,fragmentShader:La.points_frag},dashed:{uniforms:pa([Ea.common,Ea.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:La.linedashed_vert,fragmentShader:La.linedashed_frag},depth:{uniforms:pa([Ea.common,Ea.displacementmap]),vertexShader:La.depth_vert,fragmentShader:La.depth_frag},normal:{uniforms:pa([Ea.common,Ea.bumpmap,Ea.normalmap,Ea.displacementmap,{opacity:{value:1}}]),vertexShader:La.normal_vert,fragmentShader:La.normal_frag},sprite:{uniforms:pa([Ea.sprite,Ea.fog]),vertexShader:La.sprite_vert,fragmentShader:La.sprite_frag},background:{uniforms:{uvTransform:{value:new Fi},t2D:{value:null}},vertexShader:La.background_vert,fragmentShader:La.background_frag},cube:{uniforms:pa([Ea.envmap,{opacity:{value:1}}]),vertexShader:La.cube_vert,fragmentShader:La.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:La.equirect_vert,fragmentShader:La.equirect_frag},distanceRGBA:{uniforms:pa([Ea.common,Ea.displacementmap,{referencePosition:{value:new qi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:La.distanceRGBA_vert,fragmentShader:La.distanceRGBA_frag},shadow:{uniforms:pa([Ea.lights,Ea.fog,{color:{value:new co(0)},opacity:{value:1}}]),vertexShader:La.shadow_vert,fragmentShader:La.shadow_frag}};function Ia(e,t,n,i){var r,o,a=new co(0),s=0,l=null,c=0,h=null;function u(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,i)}return{getClearColor:function(){return a},setClearColor:function(e,t){a.set(e),u(a,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(a,s=e)},render:function(t,i,p,d){var f=i.background,m=e.xr,v=m.getSession&&m.getSession();if(v&&"additive"===v.environmentBlendMode&&(f=null),null===f?u(a,s):f&&f.isColor&&(u(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||f.mapping===$n)){void 0===o&&((o=new na(new ha(1,1,1),new fa({type:"BackgroundCubeMaterial",uniforms:ua(Ca.cube.uniforms),vertexShader:Ca.cube.vertexShader,fragmentShader:Ca.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(o));var g=f.isWebGLCubeRenderTarget?f.texture:f;o.material.uniforms.envMap.value=g,o.material.uniforms.flipEnvMap.value=g.isCubeTexture?-1:1,l===f&&c===g.version&&h===e.toneMapping||(o.material.needsUpdate=!0,l=f,c=g.version,h=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new na(new Pa(2,2),new fa({type:"BackgroundMaterial",uniforms:ua(Ca.background.uniforms),vertexShader:Ca.background.vertexShader,fragmentShader:Ca.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(r)),r.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),r.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&h===e.toneMapping||(r.material.needsUpdate=!0,l=f,c=f.version,h=e.toneMapping),t.unshift(r,r.geometry,r.material,0,0,null))}}}function Ra(e,t,n,i){var r,o=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r)},this.renderInstances=function(i,a,s,l){if(0!==l){var c,h;if(o)c=e,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,a,s,l),n.update(s,r,l)}}}function Oa(e,t,n){var i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,a=void 0!==n.precision?n.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=h>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:o?e.getParameter(36183):0}}function Da(){var e=this,t=null,n=0,i=!1,r=!1,o=new Yr,a=new Fi,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,i,r){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==r||null===c){var h=i+4*l,u=n.matrixWorldInverse;a.getNormalMatrix(u),(null===c||c.length<h)&&(c=new Float32Array(h));for(var p=0,d=i;p!==l;++p,d+=4)o.copy(t[p]).applyMatrix4(u,a),o.normal.toArray(c,d),c[d+3]=o.constant}s.value=c,s.needsUpdate=!0}return e.numPlanes=l,e.numIntersection=0,c}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,o){var a=0!==e.length||r||0!==n||i;return i=r,t=c(e,o,0),n=e.length,a},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1,l()},this.setState=function(e,o,a,h,u,p){if(!i||null===e||0===e.length||r&&!a)r?c(null):l();else{var d=r?0:n,f=4*d,m=u.clippingState||null;s.value=m,m=c(e,h,f,p);for(var v=0;v!==f;++v)m[v]=t[v];u.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=d}}}function Na(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function Fa(e,t,n){var i=new WeakMap,r=new WeakMap;function o(e){var a=e.target,s=i.get(a);for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);a.removeEventListener("dispose",o),i.delete(a);var c=r.get(s);c&&(t.remove(c),r.delete(s)),n.memory.geometries--}function a(e){var n=[],i=e.index,o=e.attributes.position,a=0;if(null!==i){var s=i.array;a=i.version;for(var l=0,c=s.length;l<c;l+=3){var h=s[l+0],u=s[l+1],p=s[l+2];n.push(h,u,u,p,p,h)}}else{s=o.array;a=o.version;for(l=0,c=s.length/3-1;l<c;l+=3){h=l+0,u=l+1,p=l+2;n.push(h,u,u,p,p,h)}}var d=new(Co(n)>65535?Ao:Eo)(n,1);d.version=a,t.update(d,34963);var f=r.get(e);f&&t.remove(f),r.set(e,d)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",o),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Bo).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var o=e.morphAttributes;for(var r in o)for(var a=o[r],s=0,l=a.length;s<l;s++)t.update(a[s],34962)},getWireframeAttribute:function(e){var t=r.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return r.get(e)}}}function za(e,t,n,i){var r,o,a,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){o=e.type,a=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,o,t*a),n.update(i,r)},this.renderInstances=function(i,l,c,h){if(0!==h){var u,p;if(s)u=e,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](r,c,o,l*a,h),n.update(c,r,h)}}}function Ba(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(i=i||1,t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ka(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ha(e){var t={},n=new Float32Array(8);return{update:function(i,r,o,a){var s=i.morphTargetInfluences,l=void 0===s?0:s.length,c=t[r.id];if(void 0===c){c=[];for(var h=0;h<l;h++)c[h]=[h,0];t[r.id]=c}var u=o.morphTargets&&r.morphAttributes.position,p=o.morphNormals&&r.morphAttributes.normal;for(h=0;h<l;h++){0!==(f=c[h])[1]&&(u&&r.deleteAttribute("morphTarget"+h),p&&r.deleteAttribute("morphNormal"+h))}for(h=0;h<l;h++){(f=c[h])[0]=h,f[1]=s[h]}c.sort(ka);var d=0;for(h=0;h<8;h++){var f;if(f=c[h]){var m=f[0],v=f[1];if(v){u&&r.setAttribute("morphTarget"+h,u[m]),p&&r.setAttribute("morphNormal"+h,p[m]),n[h]=v,d+=v;continue}}n[h]=0}var g=r.morphTargetsRelative?1:1-d;a.getUniforms().setValue(e,"morphTargetBaseInfluence",g),a.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Ua(e,t,n,i){var r=new WeakMap;return{update:function(e){var o=i.render.frame,a=e.geometry,s=t.get(e,a);return r.get(s)!==o&&(a.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,o)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function Ga(e,t,n,i,r,o,a,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,a=void 0!==a?a:fi,ki.call(this,e,t,n,i,r,o,a,s,l,c),this.flipY=!1}function ja(e,t,n,i){ki.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ii,this.minFilter=ii,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Va(e,t,n,i){ki.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ii,this.minFilter=ii,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Ca.physical={uniforms:pa([Ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ni(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new co(0)},transparency:{value:0}}]),vertexShader:La.meshphysical_vert,fragmentShader:La.meshphysical_frag},Ga.prototype=Object.create(ki.prototype),Ga.prototype.constructor=Ga,Ga.prototype.isCubeTexture=!0,Object.defineProperty(Ga.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),ja.prototype=Object.create(ki.prototype),ja.prototype.constructor=ja,ja.prototype.isDataTexture2DArray=!0,Va.prototype=Object.create(ki.prototype),Va.prototype.constructor=Va,Va.prototype.isDataTexture3D=!0;var Wa=new ki,qa=new ja,Xa=new Va,Ya=new Ga,Qa=[],Za=[],Ja=new Float32Array(16),Ka=new Float32Array(9),$a=new Float32Array(4);function es(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,o=Qa[r];if(void 0===o&&(o=new Float32Array(r),Qa[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function ts(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function ns(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function is(e,t){var n=Za[t];void 0===n&&(n=new Int32Array(t),Za[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function rs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function os(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ts(n,t))return;e.uniform2fv(this.addr,t),ns(n,t)}}function as(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(ts(n,t))return;e.uniform3fv(this.addr,t),ns(n,t)}}function ss(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ts(n,t))return;e.uniform4fv(this.addr,t),ns(n,t)}}function ls(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ts(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ns(n,t)}else{if(ts(n,i))return;$a.set(i),e.uniformMatrix2fv(this.addr,!1,$a),ns(n,i)}}function cs(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ts(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ns(n,t)}else{if(ts(n,i))return;Ka.set(i),e.uniformMatrix3fv(this.addr,!1,Ka),ns(n,i)}}function hs(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ts(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ns(n,t)}else{if(ts(n,i))return;Ja.set(i),e.uniformMatrix4fv(this.addr,!1,Ja),ns(n,i)}}function us(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||Wa,r)}function ps(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||qa,r)}function ds(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Xa,r)}function fs(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||Ya,r)}function ms(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function vs(e,t){var n=this.cache;ts(n,t)||(e.uniform2iv(this.addr,t),ns(n,t))}function gs(e,t){var n=this.cache;ts(n,t)||(e.uniform3iv(this.addr,t),ns(n,t))}function ys(e,t){var n=this.cache;ts(n,t)||(e.uniform4iv(this.addr,t),ns(n,t))}function xs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function bs(e,t){e.uniform1fv(this.addr,t)}function ws(e,t){e.uniform1iv(this.addr,t)}function _s(e,t){e.uniform2iv(this.addr,t)}function Ms(e,t){e.uniform3iv(this.addr,t)}function Es(e,t){e.uniform4iv(this.addr,t)}function Ss(e,t){var n=es(t,this.size,2);e.uniform2fv(this.addr,n)}function As(e,t){var n=es(t,this.size,3);e.uniform3fv(this.addr,n)}function Ts(e,t){var n=es(t,this.size,4);e.uniform4fv(this.addr,n)}function Ps(e,t){var n=es(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Ls(e,t){var n=es(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Cs(e,t){var n=es(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Is(e,t,n){var i=t.length,r=is(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.safeSetTexture2D(t[o]||Wa,r[o])}function Rs(e,t,n){var i=t.length,r=is(n,i);e.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.safeSetTextureCube(t[o]||Ya,r[o])}function Os(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return rs;case 35664:return os;case 35665:return as;case 35666:return ss;case 35674:return ls;case 35675:return cs;case 35676:return hs;case 5124:case 35670:return ms;case 35667:case 35671:return vs;case 35668:case 35672:return gs;case 35669:case 35673:return ys;case 5125:return xs;case 35678:case 36198:case 36298:case 36306:case 35682:return us;case 35679:case 36299:case 36307:return ds;case 35680:case 36300:case 36308:case 36293:return fs;case 36289:case 36303:case 36311:case 36292:return ps}}(t.type)}function Ds(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return bs;case 35664:return Ss;case 35665:return As;case 35666:return Ts;case 35674:return Ps;case 35675:return Ls;case 35676:return Cs;case 5124:case 35670:return ws;case 35667:case 35671:return _s;case 35668:case 35672:return Ms;case 35669:case 35673:return Es;case 35678:case 36198:case 36298:case 36306:case 35682:return Is;case 35680:case 36300:case 36308:case 36293:return Rs}}(t.type)}function Ns(e){this.id=e,this.seq=[],this.map={}}Ds.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ns(t,e)},Ns.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,o=i.length;r!==o;++r){var a=i[r];a.setValue(e,t[a.id],n)}};var Fs=/([\w\d_]+)(\])?(\[|\.)?/g;function zs(e,t){e.seq.push(t),e.map[t.id]=t}function Bs(e,t,n){var i=e.name,r=i.length;for(Fs.lastIndex=0;;){var o=Fs.exec(i),a=Fs.lastIndex,s=o[1],l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===r){zs(n,void 0===c?new Os(s,e,t):new Ds(s,e,t));break}var h=n.map[s];void 0===h&&zs(n,h=new Ns(s)),n=h}}function ks(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);Bs(r,e.getUniformLocation(t,r.name),this)}}function Hs(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}ks.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},ks.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},ks.upload=function(e,t,n,i){for(var r=0,o=t.length;r!==o;++r){var a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}},ks.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var o=e[i];o.id in t&&n.push(o)}return n};var Us=0;function Gs(e){switch(e){case Si:return["Linear","( value )"];case Ai: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:throw new Error("unsupported encoding: "+e)}}function js(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Vs(e,t){var n=Gs(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Ws(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Uncharted2";break;case 4:n="OptimizedCineon";break;case 5:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function qs(e){return""!==e}function Xs(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ys(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Qs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Zs(e){return e.replace(Qs,Js)}function Js(e,t){var n=La[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Zs(n)}var Ks=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,$s=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function el(e){return e.replace($s,nl).replace(Ks,tl)}function tl(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),nl(e,t,n,i)}function nl(e,t,n,i){for(var r="",o=parseInt(t);o<parseInt(n);o++)r+=i.replace(/\[ i \]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function il(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function rl(e,t,n){var i,r,o,a,s,l=e.getContext(),c=n.defines,h=n.vertexShader,u=n.fragmentShader,p=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),d=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case $n:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}(n),f=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}(n),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),v=e.gammaFactor>0?e.gammaFactor:1,g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(qs).join("\n")}(n),y=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(c),x=l.createProgram();if(n.isRawShaderMaterial?((i=[y].filter(qs).join("\n")).length>0&&(i+="\n"),(r=[g,y].filter(qs).join("\n")).length>0&&(r+="\n")):(i=[il(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+v,"#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 "+f:"",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.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",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 "+p:"",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"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef 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(qs).join("\n"),r=[g,il(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+v,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 "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",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.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",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 "+p:"",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?La.tonemapping_pars_fragment:"",0!==n.toneMapping?Ws("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?La.encodings_pars_fragment:"",n.mapEncoding?Vs("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Vs("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Vs("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Vs("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Vs("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(o="linearToOutputTexel",a=n.outputEncoding,s=Gs(a),"vec4 "+o+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(qs).join("\n")),h=Ys(h=Xs(h=Zs(h),n),n),u=Ys(u=Xs(u=Zs(u),n),n),h=el(h),u=el(u),n.isWebGL2&&!n.isRawShaderMaterial){var b=!1,w=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(w)&&null!==u.match(w)&&(b=!0,h=h.replace(w,""),u=u.replace(w,"")),i=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,r=["#version 300 es\n","#define varying in",b?"":"out highp vec4 pc_fragColor;",b?"":"#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"+r}var _,M,E=r+u,S=Hs(l,35633,i+h),A=Hs(l,35632,E);if(l.attachShader(x,S),l.attachShader(x,A),void 0!==n.index0AttributeName?l.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(x,0,"position"),l.linkProgram(x),e.debug.checkShaderErrors){var T=l.getProgramInfoLog(x).trim(),P=l.getShaderInfoLog(S).trim(),L=l.getShaderInfoLog(A).trim(),C=!0,I=!0;if(!1===l.getProgramParameter(x,35714)){C=!1;var R=js(l,S,"vertex"),O=js(l,A,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(x,35715),"gl.getProgramInfoLog",T,R,O)}else""!==T?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",T):""!==P&&""!==L||(I=!1);I&&(this.diagnostics={runnable:C,programLog:T,vertexShader:{log:P,prefix:i},fragmentShader:{log:L,prefix:r}})}return l.deleteShader(S),l.deleteShader(A),this.getUniforms=function(){return void 0===_&&(_=new ks(l,x)),_},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var o=e.getActiveAttrib(t,r).name;n[o]=e.getAttribLocation(t,o)}return n}(l,x)),M},this.destroy=function(){l.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=Us++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=S,this.fragmentShader=A,this}function ol(e,t,n){var i=[],r=n.isWebGL2,o=n.logarithmicDepthBuffer,a=n.floatVertexTextures,s=n.precision,l=n.maxVertexUniforms,c=n.vertexTextures,h={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"},u=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function p(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=Si,t}this.getParameters=function(i,u,d,f,m,v,g){var y=f.fog,x=i.isMeshStandardMaterial?f.environment:null,b=i.envMap||x,w=h[i.type],_=g.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(a)return 1024;var n=l,i=Math.floor((n-20)/4),r=Math.min(i,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(g):0;null!==i.precision&&(s=n.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",s,"instead.");var M=function(e,t){var n;if(t){var i=Ca[t];n={name:e.type,uniforms:da.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(i,w);i.onBeforeCompile(M,e);var E=e.getRenderTarget();return{isWebGL2:r,shaderID:w,shaderName:M.name,uniforms:M.uniforms,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,defines:i.defines,isRawShaderMaterial:i.isRawShaderMaterial,isShaderMaterial:i.isShaderMaterial,precision:s,instancing:!0===g.isInstancedMesh,supportsVertexTextures:c,outputEncoding:null!==E?p(E.texture):e.outputEncoding,map:!!i.map,mapEncoding:p(i.map),matcap:!!i.matcap,matcapEncoding:p(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:p(b),envMapCubeUV:!!b&&(b.mapping===$n||307===b.mapping),lightMap:!!i.lightMap,lightMapEncoding:p(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:p(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||!i.displacementMap),fog:!!y,useFog:i.fog,fogExp2:y&&y.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:o,skinning:i.skinning&&_>0,maxBones:_,useVertexTexture:a,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:v,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:r||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:i.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var r=0;r<u.length;r++)n.push(t[u[r]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var r,o=0,a=i.length;o<a;o++){var s=i[o];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new rl(e,n,t),i.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i}function al(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function sl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ll(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function cl(){var e=[],t=0,n=[],i=[],r={id:-1};function o(n,i,o,a,s,l){var c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:i,material:o,program:o.program||r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=o,c.program=o.program||r,c.groupOrder=a,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transparent:i,init:function(){t=0,n.length=0,i.length=0},push:function(e,t,r,a,s,l){var c=o(e,t,r,a,s,l);(!0===r.transparent?i:n).push(c)},unshift:function(e,t,r,a,s,l){var c=o(e,t,r,a,s,l);(!0===r.transparent?i:n).unshift(c)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||sl),i.length>1&&i.sort(t||ll)}}}function hl(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,o=e.get(n);return void 0===o?(r=new cl,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=o.get(i))&&(r=new cl,o.set(i,r)),r},dispose:function(){e=new WeakMap}}}function ul(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new qi,color:new co};break;case"SpotLight":n={position:new qi,direction:new qi,color:new co,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new qi,color:new co,distance:0,decay:0};break;case"HemisphereLight":n={direction:new qi,skyColor:new co,groundColor:new co};break;case"RectAreaLight":n={color:new co,position:new qi,halfWidth:new qi,halfHeight:new qi}}return e[t.id]=n,n}}}var pl=0;function dl(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function fl(){for(var e,t=new ul,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new Ni};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new Ni,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}),i={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:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)i.probe.push(new qi);var o=new qi,a=new er,s=new er;return{setup:function(e,r,l){for(var c=0,h=0,u=0,p=0;p<9;p++)i.probe[p].set(0,0,0);var d=0,f=0,m=0,v=0,g=0,y=0,x=0,b=0,w=l.matrixWorldInverse;e.sort(dl),p=0;for(var _=e.length;p<_;p++){var M=e[p],E=M.color,S=M.intensity,A=M.distance,T=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)c+=E.r*S,h+=E.g*S,u+=E.b*S;else if(M.isLightProbe)for(var P=0;P<9;P++)i.probe[P].addScaledVector(M.sh.coefficients[P],S);else if(M.isDirectionalLight){if((I=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),I.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),I.direction.sub(o),I.direction.transformDirection(w),M.castShadow){var L=M.shadow;(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,i.directionalShadow[d]=C,i.directionalShadowMap[d]=T,i.directionalShadowMatrix[d]=M.shadow.matrix,y++}i.directional[d]=I,d++}else if(M.isSpotLight){if((I=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),I.position.applyMatrix4(w),I.color.copy(E).multiplyScalar(S),I.distance=A,I.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),I.direction.sub(o),I.direction.transformDirection(w),I.coneCos=Math.cos(M.angle),I.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),I.decay=M.decay,M.castShadow){L=M.shadow;(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,i.spotShadow[m]=C,i.spotShadowMap[m]=T,i.spotShadowMatrix[m]=M.shadow.matrix,b++}i.spot[m]=I,m++}else if(M.isRectAreaLight){(I=t.get(M)).color.copy(E).multiplyScalar(S),I.position.setFromMatrixPosition(M.matrixWorld),I.position.applyMatrix4(w),s.identity(),a.copy(M.matrixWorld),a.premultiply(w),s.extractRotation(a),I.halfWidth.set(.5*M.width,0,0),I.halfHeight.set(0,.5*M.height,0),I.halfWidth.applyMatrix4(s),I.halfHeight.applyMatrix4(s),i.rectArea[v]=I,v++}else if(M.isPointLight){if((I=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),I.position.applyMatrix4(w),I.color.copy(M.color).multiplyScalar(M.intensity),I.distance=M.distance,I.decay=M.decay,M.castShadow){var C;L=M.shadow;(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,C.shadowCameraNear=L.camera.near,C.shadowCameraFar=L.camera.far,i.pointShadow[f]=C,i.pointShadowMap[f]=T,i.pointShadowMatrix[f]=M.shadow.matrix,x++}i.point[f]=I,f++}else if(M.isHemisphereLight){var I;(I=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),I.direction.transformDirection(w),I.direction.normalize(),I.skyColor.copy(M.color).multiplyScalar(S),I.groundColor.copy(M.groundColor).multiplyScalar(S),i.hemi[g]=I,g++}}i.ambient[0]=c,i.ambient[1]=h,i.ambient[2]=u;var R=i.hash;R.directionalLength===d&&R.pointLength===f&&R.spotLength===m&&R.rectAreaLength===v&&R.hemiLength===g&&R.numDirectionalShadows===y&&R.numPointShadows===x&&R.numSpotShadows===b||(i.directional.length=d,i.spot.length=m,i.rectArea.length=v,i.point.length=f,i.hemi.length=g,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=x,i.spotShadowMatrix.length=b,R.directionalLength=d,R.pointLength=f,R.spotLength=m,R.rectAreaLength=v,R.hemiLength=g,R.numDirectionalShadows=y,R.numPointShadows=x,R.numSpotShadows=b,i.version=pl++)},state:i}}function ml(){var e=new fl,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(i){e.setup(t,n,i)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function vl(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r;return!1===e.has(n)?(r=new ml,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):!1===e.get(n).has(i)?(r=new ml,e.get(n).set(i,r)):r=e.get(n).get(i),r},dispose:function(){e=new WeakMap}}}function gl(e){vo.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,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(e)}function yl(e){vo.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new qi,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}gl.prototype=Object.create(vo.prototype),gl.prototype.constructor=gl,gl.prototype.isMeshDepthMaterial=!0,gl.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},yl.prototype=Object.create(vo.prototype),yl.prototype.constructor=yl,yl.prototype.isMeshDistanceMaterial=!0,yl.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function xl(e,t,n){var i=new Ma,r=new Ni,o=new Ni,a=new Hi,s=[],l=[],c={},h={0:1,1:0,2:2},u=new fa({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ni},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONAL_PASS=1;var d=new Bo;d.setAttribute("position",new xo(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new na(d,u),m=this;function v(n,i){var r=t.update(f);u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,u,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,p,f,null)}function g(e,t,n){var i=e<<0|t<<1|n<<2,r=s[i];return void 0===r&&(r=new gl({depthPacking:3201,morphTargets:e,skinning:t}),s[i]=r),r}function y(e,t,n){var i=e<<0|t<<1|n<<2,r=l[i];return void 0===r&&(r=new yl({morphTargets:e,skinning:t}),l[i]=r),r}function x(t,n,i,r,o,a,s){var l=null,u=g,p=t.customDepthMaterial;if(!0===r.isPointLight&&(u=y,p=t.customDistanceMaterial),void 0===p){var d=!1;!0===i.morphTargets&&(d=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===i.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(d,f,!0===t.isInstancedMesh)}else l=p;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=l.uuid,v=i.uuid,x=c[m];void 0===x&&(x={},c[m]=x);var b=x[v];void 0===b&&(b=l.clone(),x[v]=b),l=b}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=a),l}function b(n,r,o,a,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var h=l.groups,u=0,p=h.length;u<p;u++){var d=h[u],f=c[d.materialIndex];if(f&&f.visible){var m=x(n,l,f,a,o.near,o.far,s);e.renderBufferDirect(o,null,l,m,n,d)}}else if(c.visible){m=x(n,l,c,a,o.near,o.far,s);e.renderBufferDirect(o,null,l,m,n,null)}}for(var v=n.children,g=0,y=v.length;g<y;g++)b(v[g],r,o,a,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var d=0,f=t.length;d<f;d++){var g=t[d],y=g.shadow;if(void 0!==y){r.copy(y.mapSize);var x=y.getFrameExtents();if(r.multiply(x),o.copy(y.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(o.x=Math.floor(n/x.x),r.x=o.x*x.x,y.mapSize.x=o.x),r.y>n&&(o.y=Math.floor(n/x.y),r.y=o.y*x.y,y.mapSize.y=o.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var w={minFilter:ai,magFilter:ai,format:mi};y.map=new Ui(r.x,r.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new Ui(r.x,r.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){w={minFilter:ii,magFilter:ii,format:mi};y.map=new Ui(r.x,r.y,w),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var E=y.getViewport(M);a.set(o.x*E.x,o.y*E.y,o.x*E.z,o.y*E.w),p.viewport(a),y.updateMatrices(g,M),i=y.getFrustum(),b(s,l,y.camera,g,this.type)}y.isPointLightShadow||3!==this.type||v(y,l)}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,h,u)}}}function bl(e,t,n){var i=n.isWebGL2;var r=new function(){var t=!1,n=new Hi,i=null,r=new Hi(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,o,a,s){!0===s&&(t*=a,i*=a,o*=a),n.set(t,i,o,a),!1===r.equals(n)&&(e.clearColor(t,i,o,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},o=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?B(2929):k(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},a=new function(){var t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?B(2960):k(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,a){i===t&&r===n&&o===a||(e.stencilFunc(t,n,a),i=t,r=n,o=a)},setOp:function(t,n,i){a===t&&s===n&&l===i||(e.stencilOp(t,n,i),a=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,o=null,a=null,s=null,l=null,c=null}}},s=e.getParameter(34921),l=new Uint8Array(s),c=new Uint8Array(s),h=new Uint8Array(s),u={},p=null,d=null,f=null,m=null,v=null,g=null,y=null,x=null,b=null,w=!1,_=null,M=null,E=null,S=null,A=null,T=e.getParameter(35661),P=!1,L=0,C=e.getParameter(7938);-1!==C.indexOf("WebGL")?(L=parseFloat(/^WebGL\ ([0-9])/.exec(C)[1]),P=L>=1):-1!==C.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(C)[1]),P=L>=2);var I=null,R={},O=new Hi,D=new Hi;function N(t,n,i){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;a<i;a++)e.texImage2D(n+a,0,6408,1,1,0,6408,5121,r);return o}var F={};function z(n,r){(l[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),h[n]!==r)&&((i?e:t.get("ANGLE_instanced_arrays"))[i?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),h[n]=r)}function B(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function k(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}F[3553]=N(3553,3553,1),F[34067]=N(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),B(2929),o.setFunc(3),V(!1),W(1),B(2884),j(0);var H={[Kn]:32774,101:32778,102:32779};if(i)H[103]=32775,H[104]=32776;else{var U=t.get("EXT_blend_minmax");null!==U&&(H[103]=U.MIN_EXT,H[104]=U.MAX_EXT)}var G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function j(t,n,i,r,o,a,s,l){if(0!==t){if(d||(B(3042),d=!0),5===t)o=o||n,a=a||i,s=s||r,n===m&&o===y||(e.blendEquationSeparate(H[n],H[o]),m=n,y=o),i===v&&r===g&&a===x&&s===b||(e.blendFuncSeparate(G[i],G[r],G[a],G[s]),v=i,g=r,x=a,b=s),f=t,w=null;else if(t!==f||l!==w){if(m===Kn&&y===Kn||(e.blendEquation(32774),m=Kn,y=Kn),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}v=null,g=null,x=null,b=null,f=t,w=l}}else d&&(k(3042),d=!1)}function V(t){_!==t&&(t?e.frontFace(2304):e.frontFace(2305),_=t)}function W(t){0!==t?(B(2884),t!==M&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):k(2884),M=t}function q(t,n,i){t?(B(32823),S===n&&A===i||(e.polygonOffset(n,i),S=n,A=i)):k(32823)}function X(t){void 0===t&&(t=33984+T-1),I!==t&&(e.activeTexture(t),I=t)}return{buffers:{color:r,depth:o,stencil:a},initAttributes:function(){for(var e=0,t=l.length;e<t;e++)l[e]=0},enableAttribute:function(e){z(e,0)},enableAttributeAndDivisor:z,disableUnusedAttributes:function(){for(var t=0,n=c.length;t!==n;++t)c[t]!==l[t]&&(e.disableVertexAttribArray(t),c[t]=0)},vertexAttribPointer:function(t,n,r,o,a,s){!0!==i||5124!==r&&5125!==r?e.vertexAttribPointer(t,n,r,o,a,s):e.vertexAttribIPointer(t,n,r,o,a,s)},enable:B,disable:k,useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:j,setMaterial:function(e,t){2===e.side?k(2884):B(2884);var n=1===e.side;t&&(n=!n),V(n),1===e.blending&&!1===e.transparent?j(0):j(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),r.setMask(e.colorWrite);var i=e.stencilWrite;a.setTest(i),i&&(a.setMask(e.stencilWriteMask),a.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),a.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==E&&(P&&e.lineWidth(t),E=t)},setPolygonOffset:q,setScissorTest:function(e){e?B(3089):k(3089)},activeTexture:X,bindTexture:function(t,n){null===I&&X();var i=R[I];void 0===i&&(i={type:void 0,texture:void 0},R[I]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||F[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=R[I];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===O.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),O.copy(t))},viewport:function(t){!1===D.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){for(var t=0;t<c.length;t++)1===c[t]&&(e.disableVertexAttribArray(t),c[t]=0);u={},I=null,R={},p=null,f=null,_=null,M=null,r.reset(),o.reset(),a.reset()}}}function wl(e,t,n,i,r,o,a){var s,l=r.isWebGL2,c=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,p=r.maxSamples,d=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(k){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var o=t?Di.floorPowerOfTwo:Math.floor,a=o(r*e.width),l=o(r*e.height);void 0===s&&(s=m(a,l));var c=n?m(a,l):s;return c.width=a,c.height=l,c.getContext("2d").drawImage(e,0,0,a,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return Di.isPowerOfTwo(e.width)&&Di.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==ii&&e.minFilter!==ai}function x(t,n,r,o){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function b(n,i,r){if(!1===l)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function w(e){return e===ii||e===ri||e===oi?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&d.delete(n),a.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}(n),a.memory.textures--}var E=0;function S(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=a.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void R(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function A(t,r){if(6===t.image.length){var a=i.get(t);if(t.version>0&&a.__version!==t.version){I(a,t),n.activeTexture(33984+r),n.bindTexture(34067,a.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),c=t.image[0]&&t.image[0].isDataTexture,u=[],p=0;p<6;p++)u[p]=s||c?c?t.image[p].image:t.image[p]:v(t.image[p],!1,!0,h);var d,f=u[0],m=g(f)||l,w=o.convert(t.format),_=o.convert(t.type),M=b(t.internalFormat,w,_);if(C(34067,t,m),s){for(p=0;p<6;p++){d=u[p].mipmaps;for(var E=0;E<d.length;E++){var S=d[E];t.format!==mi&&t.format!==fi?null!==w?n.compressedTexImage2D(34069+p,E,M,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+p,E,M,S.width,S.height,0,w,_,S.data)}}a.__maxMipLevel=d.length-1}else{d=t.mipmaps;for(p=0;p<6;p++)if(c){n.texImage2D(34069+p,0,M,u[p].width,u[p].height,0,w,_,u[p].data);for(E=0;E<d.length;E++){var A=(S=d[E]).image[p].image;n.texImage2D(34069+p,E+1,M,A.width,A.height,0,w,_,A.data)}}else{n.texImage2D(34069+p,0,M,w,_,u[p]);for(E=0;E<d.length;E++){S=d[E];n.texImage2D(34069+p,E+1,M,w,_,S.image[p])}}a.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),a.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+r),n.bindTexture(34067,a.__webglTexture)}}function T(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}var P={[ei]:10497,[ti]:33071,[ni]:33648},L={[ii]:9728,[ri]:9984,[oi]:9986,[ai]:9729,1007:9985,[si]:9987};function C(n,o,a){a?(e.texParameteri(n,10242,P[o.wrapS]),e.texParameteri(n,10243,P[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[o.wrapR]),e.texParameteri(n,10240,L[o.magFilter]),e.texParameteri(n,10241,L[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),o.wrapS===ti&&o.wrapT===ti||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(o.magFilter)),e.texParameteri(n,10241,w(o.minFilter)),o.minFilter!==ii&&o.minFilter!==ai&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(o.type===ui&&null===t.get("OES_texture_float_linear"))return;if(o.type===pi&&null===(l||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function I(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),a.memory.textures++)}function R(t,i,r){var a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),I(t,i),n.activeTexture(33984+r),n.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=function(e){return!l&&(e.wrapS!==ti||e.wrapT!==ti||e.minFilter!==ii&&e.minFilter!==ai)}(i)&&!1===g(i.image),c=v(i.image,s,!1,u),h=g(c)||l,p=o.convert(i.format),d=o.convert(i.type),f=b(i.internalFormat,p,d);C(a,i,h);var m,w=i.mipmaps;if(i.isDepthTexture)f=6402,l?f=i.type===ui?36012:i.type===hi?33190:i.type===di?35056:33189:i.type===ui&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===vi&&6402===f&&i.type!==ci&&i.type!==hi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=ci,d=o.convert(i.type)),i.format===gi&&6402===f&&(f=34041,i.type!==di&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=di,d=o.convert(i.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,d,null);else if(i.isDataTexture)if(w.length>0&&h){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,c.width,c.height,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],i.format!==mi&&i.format!==fi?null!==p?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(w.length>0&&h){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,p,d,m);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,p,d,c),t.__maxMipLevel=0;y(i,h)&&x(a,i,c.width,c.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function O(t,r,a,s){var l=o.convert(r.texture.format),c=o.convert(r.texture.type),h=b(r.texture.internalFormat,l,c);n.texImage2D(s,0,h,r.width,r.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,a,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function D(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var a=n.depthTexture;a&&a.isDepthTexture&&(a.type===ui?r=36012:a.type===hi&&(r=33190));var s=F(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){s=F(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var l=o.convert(n.texture.format),c=o.convert(n.texture.type);r=b(n.texture.internalFormat,l,c);if(i){s=F(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){var n=i.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),S(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===vi)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(n.depthTexture.format!==gi)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(36160,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),D(n.__webglDepthbuffer[o],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),D(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function F(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var z=!1,B=!1;this.allocateTextureUnit=function(){var e=E;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=S,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?R(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?R(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=A,this.setTextureCubeDynamic=T,this.setupRenderTarget=function(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),a.memory.textures++;var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=g(t)||l;if(!l||t.texture.format!==fi||t.texture.type!==ui&&t.texture.type!==pi||(t.texture.format=mi,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(var p=0;p<6;p++)r.__webglFramebuffer[p]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),h)if(l){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var d=o.convert(t.texture.format),f=o.convert(t.texture.type),m=b(t.texture.internalFormat,d,f),v=F(t);e.renderbufferStorageMultisample(36161,v,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),D(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),C(34067,t.texture,u);for(p=0;p<6;p++)O(r.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,u)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),C(3553,t.texture,u),O(r.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||l)){var r=e.isWebGLCubeRenderTarget?34067:3553,o=i.get(t).__webglTexture;n.bindTexture(r,o),x(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,o=t.height,a=16384;t.depthBuffer&&(a|=256),t.stencilBuffer&&(a|=1024),e.blitFramebuffer(0,0,r,o,0,0,r,o,a,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),z=!0),e=e.texture),S(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?A(e,t):T(e,t)}}function _l(e,t,n){var i=n.isWebGL2;return{convert:function(e){var n;if(e===li)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(e===ci)return 5123;if(1013===e)return 5124;if(e===hi)return 5125;if(e===ui)return 5126;if(e===pi)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(e===fi)return 6407;if(e===mi)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(e===vi)return 6402;if(e===gi)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===di?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Ml(e){va.call(this),this.cameras=e||[]}function El(){yr.call(this),this.type="Group"}function Sl(){this._targetRay=null,this._grip=null}function Al(e,t){var n=this,i=null,r=1,o=null,a="local-floor",s=null,l=[],c=new Map,h=new va;h.layers.enable(1),h.viewport=new Hi;var u=new va;u.layers.enable(2),u.viewport=new Hi;var p=[h,u],d=new Ml;d.layers.enable(1),d.layers.enable(2);var f=null,m=null;function v(e){var t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function g(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),E.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){o=e,E.setContext(i),E.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function x(e){for(var t=i.inputSources,n=0;n<l.length;n++)c.set(t[n],l[n]);for(n=0;n<e.removed.length;n++){var r=e.removed[n];(o=c.get(r))&&(o.dispatchEvent({type:"disconnected",data:r}),c.delete(r))}for(n=0;n<e.added.length;n++){var o;r=e.added[n];(o=c.get(r))&&o.dispatchEvent({type:"connected",data:r})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=l[e];return void 0===t&&(t=new Sl,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=l[e];return void 0===t&&(t=new Sl,l[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return i},this.setSession=function(e){if(null!==(i=e)){i.addEventListener("select",v),i.addEventListener("selectstart",v),i.addEventListener("selectend",v),i.addEventListener("squeeze",v),i.addEventListener("squeezestart",v),i.addEventListener("squeezeend",v),i.addEventListener("end",g);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var o={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(i,t,o);i.updateRenderState({baseLayer:s}),i.requestReferenceSpace(a).then(y),i.addEventListener("inputsourceschange",x)}};var b=new qi,w=new qi;function _(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){d.near=u.near=h.near=e.near,d.far=u.far=h.far=e.far,f===d.near&&m===d.far||(i.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);var t=e.parent,n=d.cameras;_(d,t);for(var r=0;r<n.length;r++)_(n[r],t);e.matrixWorld.copy(d.matrixWorld);for(var o=e.children,a=(r=0,o.length);r<a;r++)o[r].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var i=b.distanceTo(w),r=t.projectionMatrix.elements,o=n.projectionMatrix.elements,a=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(o[8]+1)/o[0],p=a*h,d=a*u,f=i/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=a+f,g=s+f,y=p-m,x=d+(i-m),_=l*s/g*v,M=c*s/g*v;e.projectionMatrix.makePerspective(y,x,_,M,v,g)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};var M=null;var E=new Sa;E.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(o))){var r=s.views,a=i.renderState.baseLayer;e.setFramebuffer(a.framebuffer);var c=!1;r.length!==d.cameras.length&&(d.cameras.length=0,c=!0);for(var h=0;h<r.length;h++){var u=r[h],f=a.getViewport(u),m=p[h];m.matrix.fromArray(u.transform.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===h&&d.matrix.copy(m.matrix),!0===c&&d.cameras.push(m)}}var v=i.inputSources;for(h=0;h<l.length;h++){var g=l[h],y=v[h];g.update(y,n,o)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function Tl(e){function t(t,n,i){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var r,o,a=n.envMap||i;a&&(t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(a).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.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),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function n(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,o,a){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i,r),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t,i),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,i,r):n(e,i,r)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,o,a):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function Pl(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,o=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,p=null;this.domElement=t,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=Si,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,f,m,v,g,y,x,b,w,_,M,E,S,A,T,P,L,C,I,R=this,O=!1,D=null,N=0,F=0,z=null,B=null,k=-1,H={geometry:null,program:null,wireframe:!1},U=null,G=null,j=new Hi,V=new Hi,W=null,q=t.width,X=t.height,Y=1,Q=null,Z=null,J=new Hi(0,0,q,X),K=new Hi(0,0,q,X),$=!1,ee=new Ma,te=new Da,ne=!1,ie=!1,re=new er,oe=new qi;function ae(){return null===z?Y:1}try{var se={alpha:i,depth:r,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(t.addEventListener("webglcontextlost",ue,!1),t.addEventListener("webglcontextrestored",pe,!1),null===(d=n||t.getContext("webgl",se)||t.getContext("experimental-webgl",se)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Me){throw console.error("THREE.WebGLRenderer: "+Me.message),Me}function le(){f=new Na(d),!1===(m=new Oa(d,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),I=new _l(d,f,m),(v=new bl(d,f,m)).scissor(V.copy(K).multiplyScalar(Y).floor()),v.viewport(j.copy(J).multiplyScalar(Y).floor()),g=new Ba(d),y=new al,x=new wl(d,f,v,y,m,I,g),b=new Aa(d,m),w=new Fa(d,b,g),_=new Ua(d,w,b,g),P=new Ha(d),M=new ol(R,f,m),E=new Tl(y),S=new hl,A=new vl,T=new Ia(R,v,_,s),L=new Ra(d,f,g,m),C=new za(d,f,g,m),g.programs=M.programs,R.capabilities=m,R.extensions=f,R.properties=y,R.renderLists=S,R.state=v,R.info=g}le();var ce=new Al(R,d);this.xr=ce;var he=new xl(R,_,m.maxTextureSize);function ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),O=!0}function pe(){console.log("THREE.WebGLRenderer: Context Restored."),O=!1,le()}function de(e){var t=e.target;t.removeEventListener("dispose",de),function(e){fe(e),y.remove(e)}(t)}function fe(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=he,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Ni),e.set(q,X)},this.setSize=function(e,n,i){ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=e,X=n,t.width=Math.floor(e*Y),t.height=Math.floor(n*Y),!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Ni),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,n,i){q=e,X=n,Y=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Hi),e.copy(j)},this.getViewport=function(e){return e.copy(J)},this.setViewport=function(e,t,n,i){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,n,i),v.viewport(j.copy(J).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(K)},this.setScissor=function(e,t,n,i){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,i),v.scissor(V.copy(K).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){v.setScissorTest($=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){Z=e},this.getClearColor=function(){return T.getClearColor()},this.setClearColor=function(){T.setClearColor.apply(T,arguments)},this.getClearAlpha=function(){return T.getClearAlpha()},this.setClearAlpha=function(){T.setClearAlpha.apply(T,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),d.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(){t.removeEventListener("webglcontextlost",ue,!1),t.removeEventListener("webglcontextrestored",pe,!1),S.dispose(),A.dispose(),y.dispose(),_.dispose(),ce.dispose(),ge.stop()},this.renderBufferImmediate=function(e,t){v.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=d.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=d.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=d.createBuffer()),e.hasColors&&!n.color&&(n.color=d.createBuffer());var i=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,n.position),d.bufferData(34962,e.positionArray,35048),v.enableAttribute(i.position),d.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,n.normal),d.bufferData(34962,e.normalArray,35048),v.enableAttribute(i.normal),d.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,n.uv),d.bufferData(34962,e.uvArray,35048),v.enableAttribute(i.uv),d.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,n.color),d.bufferData(34962,e.colorArray,35048),v.enableAttribute(i.color),d.vertexAttribPointer(i.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var me=new xr;this.renderBufferDirect=function(e,t,n,i,r,o){null===t&&(t=me);var a=r.isMesh&&r.matrixWorld.determinant()<0,s=_e(e,t,i,r);v.setMaterial(i,a);var l=!1;H.geometry===n.id&&H.program===s.id&&H.wireframe===(!0===i.wireframe)||(H.geometry=n.id,H.program=s.id,H.wireframe=!0===i.wireframe,l=!0),(i.morphTargets||i.morphNormals)&&(P.update(r,n,i,s),l=!0),!0===r.isInstancedMesh&&(l=!0);var c=n.index,h=n.attributes.position;if(null===c){if(void 0===h||0===h.count)return}else if(0===c.count)return;var u,p=1;!0===i.wireframe&&(c=w.getWireframeAttribute(n),p=2);var g=L;null!==c&&(u=b.get(c),(g=C).setIndex(u)),l&&(!function(e,t,n,i){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;v.initAttributes();var r=t.attributes,o=i.getAttributes(),a=n.defaultAttributeValues;for(var s in o){var l=o[s];if(l>=0){var c=r[s];if(void 0!==c){var h=c.normalized,u=c.itemSize;if(void 0===(M=b.get(c)))continue;var p=M.buffer,g=M.type,y=M.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,w=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):v.enableAttribute(l),d.bindBuffer(34962,p),v.vertexAttribPointer(l,u,g,h,w*y,_*y)}else c.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=c.meshPerAttribute*c.count)):v.enableAttribute(l),d.bindBuffer(34962,p),v.vertexAttribPointer(l,u,g,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;p=M.buffer,g=M.type;v.enableAttributeAndDivisor(l+0,1),v.enableAttributeAndDivisor(l+1,1),v.enableAttributeAndDivisor(l+2,1),v.enableAttributeAndDivisor(l+3,1),d.bindBuffer(34962,p),d.vertexAttribPointer(l+0,4,g,!1,64,0),d.vertexAttribPointer(l+1,4,g,!1,64,16),d.vertexAttribPointer(l+2,4,g,!1,64,32),d.vertexAttribPointer(l+3,4,g,!1,64,48)}else if(void 0!==a){var E=a[s];if(void 0!==E)switch(E.length){case 2:d.vertexAttrib2fv(l,E);break;case 3:d.vertexAttrib3fv(l,E);break;case 4:d.vertexAttrib4fv(l,E);break;default:d.vertexAttrib1fv(l,E)}}}}v.disableUnusedAttributes()}(r,n,i,s),null!==c&&d.bindBuffer(34963,u.buffer));var y=null!==c?c.count:h.count,x=n.drawRange.start*p,_=n.drawRange.count*p,M=null!==o?o.start*p:0,E=null!==o?o.count*p:1/0,S=Math.max(x,M),A=Math.min(y,x+_,M+E)-1,T=Math.max(0,A-S+1);if(0!==T){if(r.isMesh)!0===i.wireframe?(v.setLineWidth(i.wireframeLinewidth*ae()),g.setMode(1)):g.setMode(4);else if(r.isLine){var I=i.linewidth;void 0===I&&(I=1),v.setLineWidth(I*ae()),r.isLineSegments?g.setMode(1):r.isLineLoop?g.setMode(2):g.setMode(3)}else r.isPoints?g.setMode(0):r.isSprite&&g.setMode(4);if(r.isInstancedMesh)g.renderInstances(n,S,T,r.count);else if(n.isInstancedBufferGeometry){var R=Math.min(n.instanceCount,n._maxInstanceCount);g.renderInstances(n,S,T,R)}else g.render(S,T)}},this.compile=function(e,t){(p=A.get(e,t)).init(),e.traverse((function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))})),p.setupLights(t);const n={};e.traverse((function(t){let i=t.material;if(i)if(Array.isArray(i))for(let r=0;r<i.length;r++){let o=i[r];o.uuid in n==!1&&(we(o,e,t),n[o.uuid]=!0)}else i.uuid in n==!1&&(we(i,e,t),n[i.uuid]=!0)}))};var ve=null;var ge=new Sa;function ye(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){i&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);var r=_.update(e);(o=e.material).visible&&u.push(e,r,o,n,oe.z,null)}}else if(e.isImmediateRenderObject)i&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re),u.push(e,null,e.material,n,oe.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==g.render.frame&&(e.skeleton.update(),e.skeleton.frame=g.render.frame),!e.frustumCulled||ee.intersectsObject(e))){i&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);r=_.update(e);var o=e.material;if(Array.isArray(o))for(var a=r.groups,s=0,l=a.length;s<l;s++){var c=a[s],h=o[c.materialIndex];h&&h.visible&&u.push(e,r,h,n,oe.z,c)}else o.visible&&u.push(e,r,o,n,oe.z,null)}var d=e.children;for(s=0,l=d.length;s<l;s++)ye(d[s],t,n,i)}}function xe(e,t,n,i){for(var r=0,o=e.length;r<o;r++){var a=e[r],s=a.object,l=a.geometry,c=void 0===i?a.material:i,h=a.group;if(n.isArrayCamera){G=n;for(var u=n.cameras,d=0,f=u.length;d<f;d++){var m=u[d];s.layers.test(m.layers)&&(v.viewport(j.copy(m.viewport)),p.setupLights(m),be(s,t,m,l,c,h))}}else G=null,be(s,t,n,l,c,h)}}function be(e,t,n,i,r,o){if(e.onBeforeRender(R,t,n,i,r,o),p=A.get(t,G||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var a=_e(n,t,r,e);v.setMaterial(r),H.geometry=null,H.program=null,H.wireframe=!1,function(e,t){e.render((function(e){R.renderBufferImmediate(e,t)}))}(e,a)}else R.renderBufferDirect(n,t,i,r,e,o);e.onAfterRender(R,t,n,i,r,o),p=A.get(t,G||n)}function we(e,t,n){var i=y.get(e),r=p.state.lights,o=p.state.shadowsArray,a=r.state.version,s=M.getParameters(e,r.state,o,t,te.numPlanes,te.numIntersection,n),l=M.getProgramCacheKey(s),c=i.program,h=!0;if(void 0===c)e.addEventListener("dispose",de);else if(c.cacheKey!==l)fe(e);else if(i.lightsStateVersion!==a)i.lightsStateVersion=a,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(c=M.acquireProgram(s,l),i.program=c,i.uniforms=s.uniforms,i.outputEncoding=s.outputEncoding,e.program=c);var u=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<R.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(d=0;d<R.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}var f=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=te.numPlanes,i.numIntersection=te.numIntersection,f.clippingPlanes=te.uniform),i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=a,i.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),v=ks.seqWithValue(m.seq,f);i.uniformsList=v}function _e(e,t,n,i){x.resetTextureUnits();var r=t.fog,o=n.isMeshStandardMaterial?t.environment:null,a=null===z?R.outputEncoding:z.texture.encoding,s=y.get(n),l=p.state.lights;if(ne&&(ie||e!==U)){var c=e===U&&n.id===k;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,c)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==r||s.environment!==o||s.needsLights&&s.lightsStateVersion!==l.state.version?we(n,t,i):void 0===s.numClippingPlanes||s.numClippingPlanes===te.numPlanes&&s.numIntersection===te.numIntersection?s.outputEncoding!==a&&we(n,t,i):we(n,t,i):(we(n,t,i),s.__version=n.version);var h,u,f=!1,g=!1,b=!1,w=s.program,_=w.getUniforms(),M=s.uniforms;if(v.useProgram(w.program)&&(f=!0,g=!0,b=!0),n.id!==k&&(k=n.id,g=!0),f||U!==e){if(_.setValue(d,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&_.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),U!==e&&(U=e,g=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var S=_.map.cameraPosition;void 0!==S&&S.setValue(d,oe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&_.setValue(d,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){_.setOptional(d,i,"bindMatrix"),_.setOptional(d,i,"bindMatrixInverse");var A=i.skeleton;if(A){var T=A.bones;if(m.floatVertexTextures){if(void 0===A.boneTexture){var P=Math.sqrt(4*T.length);P=Di.ceilPowerOfTwo(P),P=Math.max(P,4);var L=new Float32Array(P*P*4);L.set(A.boneMatrices);var C=new ba(L,P,P,mi,ui);A.boneMatrices=L,A.boneTexture=C,A.boneTextureSize=P}_.setValue(d,"boneTexture",A.boneTexture,x),_.setValue(d,"boneTextureSize",A.boneTextureSize)}else _.setOptional(d,A,"boneMatrices")}}return(g||s.receiveShadow!==i.receiveShadow)&&(s.receiveShadow=i.receiveShadow,_.setValue(d,"receiveShadow",i.receiveShadow)),g&&(_.setValue(d,"toneMappingExposure",R.toneMappingExposure),_.setValue(d,"toneMappingWhitePoint",R.toneMappingWhitePoint),s.needsLights&&(u=b,(h=M).ambientLightColor.needsUpdate=u,h.lightProbe.needsUpdate=u,h.directionalLights.needsUpdate=u,h.directionalLightShadows.needsUpdate=u,h.pointLights.needsUpdate=u,h.pointLightShadows.needsUpdate=u,h.spotLights.needsUpdate=u,h.spotLightShadows.needsUpdate=u,h.rectAreaLights.needsUpdate=u,h.hemisphereLights.needsUpdate=u),r&&n.fog&&E.refreshFogUniforms(M,r),E.refreshMaterialUniforms(M,n,o,Y,X),void 0!==M.ltc_1&&(M.ltc_1.value=Ea.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=Ea.LTC_2),ks.upload(d,s.uniformsList,M,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ks.upload(d,s.uniformsList,M,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(d,"center",i.center),_.setValue(d,"modelViewMatrix",i.modelViewMatrix),_.setValue(d,"normalMatrix",i.normalMatrix),_.setValue(d,"modelMatrix",i.matrixWorld),w}ge.setAnimationLoop((function(e){ce.isPresenting||ve&&ve(e)})),"undefined"!=typeof window&&ge.setContext(window),this.setAnimationLoop=function(e){ve=e,ce.setAnimationLoop(e),ge.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!O){H.geometry=null,H.program=null,H.wireframe=!1,k=-1,U=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ce.enabled&&ce.isPresenting&&(t=ce.getCamera(t)),e.onBeforeRender(R,e,t,n||z),(p=A.get(e,t)).init(),re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(re),ie=this.localClippingEnabled,ne=te.init(this.clippingPlanes,ie,t),(u=S.get(e,t)).init(),ye(e,t,0,R.sortObjects),u.finish(),!0===R.sortObjects&&u.sort(Q,Z),ne&&te.beginShadows();var r=p.state.shadowsArray;he.render(r,e,t),p.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),T.render(u,e,t,i);var o=u.opaque,a=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;o.length&&xe(o,e,t,s),a.length&&xe(a,e,t,s)}else o.length&&xe(o,e,t),a.length&&xe(a,e,t);e.onAfterRender(R,e,t),null!==z&&(x.updateRenderTargetMipmap(z),x.updateMultisampleRenderTarget(z)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),u=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){D!==e&&null===z&&d.bindFramebuffer(36160,e),D=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return z},this.setRenderTarget=function(e,t,n){z=e,N=t,F=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var i=D,r=!1;if(e){var o=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=o[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:o,j.copy(e.viewport),V.copy(e.scissor),W=e.scissorTest}else j.copy(J).multiplyScalar(Y).floor(),V.copy(K).multiplyScalar(Y).floor(),W=$;if(B!==i&&(d.bindFramebuffer(36160,i),B=i),v.viewport(j),v.scissor(V),v.setScissorTest(W),r){var a=y.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),a.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,o,a){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var l=!1;s!==B&&(d.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,h=c.format,u=c.type;if(h!==mi&&I.convert(h)!==d.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===li||I.convert(u)===d.getParameter(35738)||u===ui&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||u===pi&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&d.readPixels(t,n,i,r,I.convert(h),I.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&d.bindFramebuffer(36160,B)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),o=Math.floor(t.image.height*i),a=I.convert(t.format);x.setTexture2D(t,0),d.copyTexImage2D(3553,n,a,e.x,e.y,r,o,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){void 0===i&&(i=0);var r=t.image.width,o=t.image.height,a=I.convert(n.format),s=I.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(3553,i,e.x,e.y,r,o,a,s,t.image.data):t.isCompressedTexture?d.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):d.texSubImage2D(3553,i,e.x,e.y,a,s,t.image),0===i&&n.generateMipmaps&&d.generateMipmap(3553),v.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ll(e,t){this.name="",this.color=new co(e),this.density=void 0!==t?t:25e-5}function Cl(e,t,n){this.name="",this.color=new co(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Il(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Pi,this.updateRange={offset:0,count:-1},this.version=0}Ml.prototype=Object.assign(Object.create(va.prototype),{constructor:Ml,isArrayCamera:!0}),El.prototype=Object.assign(Object.create(yr.prototype),{constructor:El,isGroup:!0}),Object.assign(Sl.prototype,{constructor:Sl,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new El,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new El,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var i=null,r=null,o=this._targetRay,a=this._grip;return e&&(null!==o&&null!==(i=t.getPose(e.targetRaySpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),this}}),Object.assign(Al.prototype,Ci.prototype),Object.assign(Ll.prototype,{isFogExp2:!0,clone:function(){return new Ll(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Cl.prototype,{isFog:!0,clone:function(){return new Cl(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Il.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Il.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Rl,Ol=new qi;function Dl(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Nl(e){vo.call(this),this.type="SpriteMaterial",this.color=new co(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Dl.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Dl.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Ol.x=this.getX(t),Ol.y=this.getY(t),Ol.z=this.getZ(t),Ol.applyMatrix4(e),this.setXYZ(t,Ol.x,Ol.y,Ol.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return new xo(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Nl.prototype=Object.create(vo.prototype),Nl.prototype.constructor=Nl,Nl.prototype.isSpriteMaterial=!0,Nl.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Fl=new qi,zl=new qi,Bl=new qi,kl=new Ni,Hl=new Ni,Ul=new er,Gl=new qi,jl=new qi,Vl=new qi,Wl=new Ni,ql=new Ni,Xl=new Ni;function Yl(e){if(yr.call(this),this.type="Sprite",void 0===Rl){Rl=new Bo;var t=new Il(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Rl.setIndex([0,1,2,0,2,3]),Rl.setAttribute("position",new Dl(t,3,0,!1)),Rl.setAttribute("uv",new Dl(t,2,3,!1))}this.geometry=Rl,this.material=void 0!==e?e:new Nl,this.center=new Ni(.5,.5)}function Ql(e,t,n,i,r,o){kl.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Hl.x=o*kl.x-r*kl.y,Hl.y=r*kl.x+o*kl.y):Hl.copy(kl),e.copy(t),e.x+=Hl.x,e.y+=Hl.y,e.applyMatrix4(Ul)}Yl.prototype=Object.assign(Object.create(yr.prototype),{constructor:Yl,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),zl.setFromMatrixScale(this.matrixWorld),Ul.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Bl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&zl.multiplyScalar(-Bl.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var o=this.center;Ql(Gl.set(-.5,-.5,0),Bl,o,zl,n,i),Ql(jl.set(.5,-.5,0),Bl,o,zl,n,i),Ql(Vl.set(.5,.5,0),Bl,o,zl,n,i),Wl.set(0,0),ql.set(1,0),Xl.set(1,1);var a=e.ray.intersectTriangle(Gl,jl,Vl,!1,Fl);if(null!==a||(Ql(jl.set(-.5,.5,0),Bl,o,zl,n,i),ql.set(0,1),null!==(a=e.ray.intersectTriangle(Gl,Vl,jl,!1,Fl)))){var s=e.ray.origin.distanceTo(Fl);s<e.near||s>e.far||t.push({distance:s,point:Fl.clone(),uv:oo.getUV(Fl,Gl,jl,Vl,Wl,ql,Xl,new Ni),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return yr.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Zl,Jl,Kl,$l,ec,tc=new qi,nc=new qi;function ic(){yr.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function rc(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),na.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new er,this.bindMatrixInverse=new er}ic.prototype=Object.assign(Object.create(yr.prototype),{constructor:ic,isLOD:!0,copy:function(e){yr.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){tc.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(tc);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){tc.setFromMatrixPosition(e.matrixWorld),nc.setFromMatrixPosition(this.matrixWorld);var n=tc.distanceTo(nc)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}},toJSON:function(e){var t=yr.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}),rc.prototype=Object.assign(Object.create(na.prototype),{constructor:rc,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Hi,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){na.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(Zl=new qi,Jl=new Hi,Kl=new Hi,$l=new qi,ec=new er,function(e,t){var n=this.skeleton,i=this.geometry;Jl.fromBufferAttribute(i.attributes.skinIndex,e),Kl.fromBufferAttribute(i.attributes.skinWeight,e),Zl.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var o=Kl.getComponent(r);if(0!==o){var a=Jl.getComponent(r);ec.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector($l.copy(Zl).applyMatrix4(ec),o)}}return t.applyMatrix4(this.bindMatrixInverse)})});var oc=new er,ac=new er;function sc(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new er)}}function lc(){yr.call(this),this.type="Bone"}Object.assign(sc.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new er;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,o=e.length;r<o;r++){var a=e[r]?e[r].matrixWorld:ac;oc.multiplyMatrices(a,t[r]),oc.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new sc(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),lc.prototype=Object.assign(Object.create(yr.prototype),{constructor:lc,isBone:!0});var cc=new er,hc=new er,uc=[],pc=new na;function dc(e,t,n){na.call(this,e,t),this.instanceMatrix=new xo(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function fc(e){vo.call(this),this.type="LineBasicMaterial",this.color=new co(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}dc.prototype=Object.assign(Object.create(na.prototype),{constructor:dc,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if(pc.geometry=this.geometry,pc.material=this.material,void 0!==pc.material)for(var r=0;r<i;r++){this.getMatrixAt(r,cc),hc.multiplyMatrices(n,cc),pc.matrixWorld=hc,pc.raycast(e,uc);for(var o=0,a=uc.length;o<a;o++){var s=uc[o];s.instanceId=r,s.object=this,t.push(s)}uc.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),fc.prototype=Object.create(vo.prototype),fc.prototype.constructor=fc,fc.prototype.isLineBasicMaterial=!0,fc.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var mc=new qi,vc=new qi,gc=new er,yc=new Vr,xc=new Fr;function bc(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),yr.call(this),this.type="Line",this.geometry=void 0!==e?e:new Bo,this.material=void 0!==t?t:new fc,this.updateMorphTargets()}bc.prototype=Object.assign(Object.create(yr.prototype),{constructor:bc,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)mc.fromBufferAttribute(t,i-1),vc.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=mc.distanceTo(vc);e.setAttribute("lineDistance",new To(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var o=e.vertices;(n=e.lineDistances)[0]=0;for(i=1,r=o.length;i<r;i++)n[i]=n[i-1],n[i]+=o[i-1].distanceTo(o[i])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xc.copy(n.boundingSphere),xc.applyMatrix4(i),xc.radius+=r,!1!==e.ray.intersectsSphere(xc)){gc.getInverse(i),yc.copy(e.ray).applyMatrix4(gc);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,s=new qi,l=new qi,c=new qi,h=new qi,u=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length-1;m<v;m+=u){var g=f[m],y=f[m+1];if(s.fromArray(d,3*g),l.fromArray(d,3*y),!(yc.distanceSqToSegment(s,l,h,c)>a))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=d.length/3-1;m<v;m+=u){if(s.fromArray(d,3*m),l.fromArray(d,3*m+3),!(yc.distanceSqToSegment(s,l,h,c)>a))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;if(!(yc.distanceSqToSegment(x[m],x[m+1],h,c)>a))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var wc=new qi,_c=new qi;function Mc(e,t){bc.call(this,e,t),this.type="LineSegments"}function Ec(e,t){bc.call(this,e,t),this.type="LineLoop"}function Sc(e){vo.call(this),this.type="PointsMaterial",this.color=new co(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Mc.prototype=Object.assign(Object.create(bc.prototype),{constructor:Mc,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)wc.fromBufferAttribute(t,i),_c.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+wc.distanceTo(_c);e.setAttribute("lineDistance",new To(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var o=e.vertices;for(n=e.lineDistances,i=0,r=o.length;i<r;i+=2)wc.copy(o[i]),_c.copy(o[i+1]),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+wc.distanceTo(_c)}return this}}),Ec.prototype=Object.assign(Object.create(bc.prototype),{constructor:Ec,isLineLoop:!0}),Sc.prototype=Object.create(vo.prototype),Sc.prototype.constructor=Sc,Sc.prototype.isPointsMaterial=!0,Sc.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Ac=new er,Tc=new Vr,Pc=new Fr,Lc=new qi;function Cc(e,t){yr.call(this),this.type="Points",this.geometry=void 0!==e?e:new Bo,this.material=void 0!==t?t:new Sc,this.updateMorphTargets()}function Ic(e,t,n,i,r,o,a){var s=Tc.distanceSqToPoint(e);if(s<n){var l=new qi;Tc.closestPointToPoint(e,l),l.applyMatrix4(i);var c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;o.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:a})}}function Rc(e,t,n,i,r,o,a,s,l){ki.call(this,e,t,n,i,r,o,a,s,l),this.format=void 0!==a?a:fi,this.minFilter=void 0!==o?o:ai,this.magFilter=void 0!==r?r:ai,this.generateMipmaps=!1}function Oc(e,t,n,i,r,o,a,s,l,c,h,u){ki.call(this,null,o,a,s,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Dc(e,t,n,i,r,o,a,s,l){ki.call(this,e,t,n,i,r,o,a,s,l),this.needsUpdate=!0}function Nc(e,t,n,i,r,o,a,s,l,c){if((c=void 0!==c?c:vi)!==vi&&c!==gi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===vi&&(n=ci),void 0===n&&c===gi&&(n=di),ki.call(this,null,i,r,o,a,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==a?a:ii,this.minFilter=void 0!==s?s:ii,this.flipY=!1,this.generateMipmaps=!1}function Fc(e){Bo.call(this),this.type="WireframeGeometry";var t,n,i,r,o,a,s,l,c,h,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],l=v[f[(n+1)%3]],p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]})}for(c in d)a=d[c],h=e.vertices[a.index1],u.push(h.x,h.y,h.z),h=e.vertices[a.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var g,y,x,b,w,_,M;if(h=new qi,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,o=x.length;r<o;++r)for(t=w=(b=x[r]).start,i=w+b.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]});for(c in d)a=d[c],h.fromBufferAttribute(g,a.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(g,a.index2),u.push(h.x,h.y,h.z)}else for(t=0,i=(g=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)_=3*t+n,h.fromBufferAttribute(g,_),u.push(h.x,h.y,h.z),M=3*t+(n+1)%3,h.fromBufferAttribute(g,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new To(u,3))}function zc(e,t,n){ca.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Bc(e,t,n)),this.mergeVertices()}function Bc(e,t,n){Bo.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,o=[],a=[],s=[],l=[],c=1e-5,h=new qi,u=new qi,p=new qi,d=new qi,f=new qi;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(i=0;i<=n;i++){var v=i/n;for(r=0;r<=t;r++){var g=r/t;e(g,v,u),a.push(u.x,u.y,u.z),g-c>=0?(e(g-c,v,p),d.subVectors(u,p)):(e(g+c,v,p),d.subVectors(p,u)),v-c>=0?(e(g,v-c,p),f.subVectors(u,p)):(e(g,v+c,p),f.subVectors(p,u)),h.crossVectors(d,f).normalize(),s.push(h.x,h.y,h.z),l.push(g,v)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var y=i*m+r,x=i*m+r+1,b=(i+1)*m+r+1,w=(i+1)*m+r;o.push(y,x,w),o.push(x,b,w)}this.setIndex(o),this.setAttribute("position",new To(a,3)),this.setAttribute("normal",new To(s,3)),this.setAttribute("uv",new To(l,2))}function kc(e,t,n,i){ca.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new Hc(e,t,n,i)),this.mergeVertices()}function Hc(e,t,n,i){Bo.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var r=[],o=[];function a(e,t,n,i){var r,o,a=Math.pow(2,i),l=[];for(r=0;r<=a;r++){l[r]=[];var c=e.clone().lerp(n,r/a),h=t.clone().lerp(n,r/a),u=a-r;for(o=0;o<=u;o++)l[r][o]=0===o&&r===a?c:c.clone().lerp(h,o/u)}for(r=0;r<a;r++)for(o=0;o<2*(a-r)-1;o++){var p=Math.floor(o/2);o%2==0?(s(l[r][p+1]),s(l[r+1][p]),s(l[r][p])):(s(l[r][p+1]),s(l[r+1][p+1]),s(l[r+1][p]))}}function s(e){r.push(e.x,e.y,e.z)}function l(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var n=new qi,i=new qi,r=new qi,o=0;o<t.length;o+=3)l(t[o+0],n),l(t[o+1],i),l(t[o+2],r),a(n,i,r,e)}(i=i||0),function(e){for(var t=new qi,n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){for(var e=new qi,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var n=h(e)/2/Math.PI+.5,i=u(e)/Math.PI+.5;o.push(n,1-i)}(function(){for(var e=new qi,t=new qi,n=new qi,i=new qi,a=new Ni,s=new Ni,l=new Ni,u=0,p=0;u<r.length;u+=9,p+=6){e.set(r[u+0],r[u+1],r[u+2]),t.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),a.set(o[p+0],o[p+1]),s.set(o[p+2],o[p+3]),l.set(o[p+4],o[p+5]),i.copy(e).add(t).add(n).divideScalar(3);var d=h(i);c(a,p+0,e,d),c(s,p+2,t,d),c(l,p+4,n,d)}})(),function(){for(var e=0;e<o.length;e+=6){var t=o[e+0],n=o[e+2],i=o[e+4],r=Math.max(t,n,i),a=Math.min(t,n,i);r>.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),i<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new To(r,3)),this.setAttribute("normal",new To(r.slice(),3)),this.setAttribute("uv",new To(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Uc(e,t){ca.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Gc(e,t)),this.mergeVertices()}function Gc(e,t){Hc.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function jc(e,t){ca.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Vc(e,t)),this.mergeVertices()}function Vc(e,t){Hc.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Wc(e,t){ca.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new qc(e,t)),this.mergeVertices()}function qc(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Hc.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Xc(e,t){ca.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Yc(e,t)),this.mergeVertices()}function Yc(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];Hc.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Qc(e,t,n,i,r,o){ca.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Zc(e,t,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Zc(e,t,n,i,r){Bo.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,l=new qi,c=new qi,h=new Ni,u=new qi,p=[],d=[],f=[],m=[];function v(r){u=e.getPointAt(r/t,u);var a=o.normals[r],h=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*a.x+m*h.x,c.y=v*a.y+m*h.y,c.z=v*a.z+m*h.z,c.normalize(),d.push(c.x,c.y,c.z),l.x=u.x+n*c.x,l.y=u.y+n*c.y,l.z=u.z+n*c.z,p.push(l.x,l.y,l.z)}}!function(){for(a=0;a<t;a++)v(a);v(!1===r?t:0),function(){for(a=0;a<=t;a++)for(s=0;s<=i;s++)h.x=a/t,h.y=s/i,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(a=1;a<=i;a++){var e=(i+1)*(s-1)+(a-1),n=(i+1)*s+(a-1),r=(i+1)*s+a,o=(i+1)*(s-1)+a;m.push(e,n,o),m.push(n,r,o)}}()}(),this.setIndex(m),this.setAttribute("position",new To(p,3)),this.setAttribute("normal",new To(d,3)),this.setAttribute("uv",new To(f,2))}function Jc(e,t,n,i,r,o,a){ca.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Kc(e,t,n,i,r,o)),this.mergeVertices()}function Kc(e,t,n,i,r,o){Bo.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,o=o||3;var a,s,l=[],c=[],h=[],u=[],p=new qi,d=new qi,f=new qi,m=new qi,v=new qi,g=new qi,y=new qi;for(a=0;a<=n;++a){var x=a/n*r*Math.PI*2;for(T(x,r,o,e,f),T(x+.01,r,o,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=i;++s){var b=s/i*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*v.x),p.y=f.y+(w*y.y+_*v.y),p.z=f.z+(w*y.z+_*v.z),c.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(a/n),u.push(s/i)}}for(s=1;s<=n;s++)for(a=1;a<=i;a++){var M=(i+1)*(s-1)+(a-1),E=(i+1)*s+(a-1),S=(i+1)*s+a,A=(i+1)*(s-1)+a;l.push(M,E,A),l.push(E,S,A)}function T(e,t,n,i,r){var o=Math.cos(e),a=Math.sin(e),s=n/t*e,l=Math.cos(s);r.x=i*(2+l)*.5*o,r.y=i*(2+l)*a*.5,r.z=i*Math.sin(s)*.5}this.setIndex(l),this.setAttribute("position",new To(c,3)),this.setAttribute("normal",new To(h,3)),this.setAttribute("uv",new To(u,2))}function $c(e,t,n,i,r){ca.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new eh(e,t,n,i,r)),this.mergeVertices()}function eh(e,t,n,i,r){Bo.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var o,a,s=[],l=[],c=[],h=[],u=new qi,p=new qi,d=new qi;for(o=0;o<=n;o++)for(a=0;a<=i;a++){var f=a/i*r,m=o/n*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),l.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),c.push(d.x,d.y,d.z),h.push(a/i),h.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=i;a++){var v=(i+1)*o+a-1,g=(i+1)*(o-1)+a-1,y=(i+1)*(o-1)+a,x=(i+1)*o+a;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute("position",new To(l,3)),this.setAttribute("normal",new To(c,3)),this.setAttribute("uv",new To(h,2))}Cc.prototype=Object.assign(Object.create(yr.prototype),{constructor:Cc,isPoints:!0,raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Pc.copy(n.boundingSphere),Pc.applyMatrix4(i),Pc.radius+=r,!1!==e.ray.intersectsSphere(Pc)){Ac.getInverse(i),Tc.copy(e.ray).applyMatrix4(Ac);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position.array;if(null!==s)for(var c=s.array,h=0,u=c.length;h<u;h++){var p=c[h];Lc.fromArray(l,3*p),Ic(Lc,p,a,i,e,t,this)}else{h=0;for(var d=l.length/3;h<d;h++)Lc.fromArray(l,3*h),Ic(Lc,h,a,i,e,t,this)}}else{var f=n.vertices;for(h=0,d=f.length;h<d;h++)Ic(f[h],h,a,i,e,t,this)}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Rc.prototype=Object.assign(Object.create(ki.prototype),{constructor:Rc,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Oc.prototype=Object.create(ki.prototype),Oc.prototype.constructor=Oc,Oc.prototype.isCompressedTexture=!0,Dc.prototype=Object.create(ki.prototype),Dc.prototype.constructor=Dc,Dc.prototype.isCanvasTexture=!0,Nc.prototype=Object.create(ki.prototype),Nc.prototype.constructor=Nc,Nc.prototype.isDepthTexture=!0,Fc.prototype=Object.create(Bo.prototype),Fc.prototype.constructor=Fc,zc.prototype=Object.create(ca.prototype),zc.prototype.constructor=zc,Bc.prototype=Object.create(Bo.prototype),Bc.prototype.constructor=Bc,kc.prototype=Object.create(ca.prototype),kc.prototype.constructor=kc,Hc.prototype=Object.create(Bo.prototype),Hc.prototype.constructor=Hc,Uc.prototype=Object.create(ca.prototype),Uc.prototype.constructor=Uc,Gc.prototype=Object.create(Hc.prototype),Gc.prototype.constructor=Gc,jc.prototype=Object.create(ca.prototype),jc.prototype.constructor=jc,Vc.prototype=Object.create(Hc.prototype),Vc.prototype.constructor=Vc,Wc.prototype=Object.create(ca.prototype),Wc.prototype.constructor=Wc,qc.prototype=Object.create(Hc.prototype),qc.prototype.constructor=qc,Xc.prototype=Object.create(ca.prototype),Xc.prototype.constructor=Xc,Yc.prototype=Object.create(Hc.prototype),Yc.prototype.constructor=Yc,Qc.prototype=Object.create(ca.prototype),Qc.prototype.constructor=Qc,Zc.prototype=Object.create(Bo.prototype),Zc.prototype.constructor=Zc,Zc.prototype.toJSON=function(){var e=Bo.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},Jc.prototype=Object.create(ca.prototype),Jc.prototype.constructor=Jc,Kc.prototype=Object.create(Bo.prototype),Kc.prototype.constructor=Kc,$c.prototype=Object.create(ca.prototype),$c.prototype.constructor=$c,eh.prototype=Object.create(Bo.prototype),eh.prototype.constructor=eh;var th=function(e,t,n){n=n||2;var i,r,o,a,s,l,c,h=t&&t.length,u=h?t[0]*n:e.length,p=nh(e,0,u,n,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(e,t,n,i){var r,o,a,s=[];for(r=0,o=t.length;r<o;r++)(a=nh(e,t[r]*i,r<o-1?t[r+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(dh(a));for(s.sort(ch),r=0;r<s.length;r++)hh(s[r],n),n=ih(n,n.next);return n}(e,t,p,n)),e.length>80*n){i=o=e[0],r=a=e[1];for(var f=n;f<u;f+=n)(s=e[f])<i&&(i=s),(l=e[f+1])<r&&(r=l),s>o&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-i,a-r))?1/c:0}return rh(p,d,n,i,r,c),d};function nh(e,t,n,i,r){var o,a;if(r===function(e,t,n,i){for(var r=0,o=t,a=n-i;o<n;o+=i)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}(e,t,n,i)>0)for(o=t;o<n;o+=i)a=Mh(o,e[o],e[o+1],a);else for(o=n-i;o>=t;o-=i)a=Mh(o,e[o],e[o+1],a);return a&&gh(a,a.next)&&(Eh(a),a=a.next),a}function ih(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!gh(i,i.next)&&0!==vh(i.prev,i,i.next))i=i.next;else{if(Eh(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function rh(e,t,n,i,r,o,a){if(e){!a&&o&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=ph(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,o,a,s,l,c=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(a>1)}(r)}(e,i,r,o);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,o?ah(e,i,r,o):oh(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Eh(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?rh(e=sh(ih(e),t,n),t,n,i,r,o,2):2===a&&lh(e,t,n,i,r,o):rh(ih(e),t,n,i,r,o,1);break}}}function oh(e){var t=e.prev,n=e,i=e.next;if(vh(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(fh(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&vh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ah(e,t,n,i){var r=e.prev,o=e,a=e.next;if(vh(r,o,a)>=0)return!1;for(var s=r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,l=r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,c=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=ph(s,l,t,n,i),p=ph(c,h,t,n,i),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&fh(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&vh(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&fh(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&vh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&fh(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&vh(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&fh(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&vh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function sh(e,t,n){var i=e;do{var r=i.prev,o=i.next.next;!gh(r,o)&&yh(r,i,i.next,o)&&wh(r,o)&&wh(o,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(o.i/n),Eh(i),Eh(i.next),i=e=o),i=i.next}while(i!==e);return ih(i)}function lh(e,t,n,i,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&mh(a,s)){var l=_h(a,s);return a=ih(a,a.next),l=ih(l,l.next),rh(a,t,n,i,r,o),void rh(l,t,n,i,r,o)}s=s.next}a=a.next}while(a!==e)}function ch(e,t){return e.x-t.x}function hh(e,t){if(t=function(e,t){var n,i=t,r=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===a)return n;var l,c=n,h=n.x,u=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=h&&r!==i.x&&fh(o<u?r:a,o,h,u,o<u?a:r,o,i.x,i.y)&&(l=Math.abs(o-i.y)/(r-i.x),wh(i,e)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&uh(n,i)))&&(n=i,p=l)),i=i.next}while(i!==c);return n}(e,t),t){var n=_h(t,e);ih(t,t.next),ih(n,n.next)}}function uh(e,t){return vh(e.prev,e,t.prev)<0&&vh(t.next,e,e.next)<0}function ph(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dh(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function fh(e,t,n,i,r,o,a,s){return(r-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(i-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function mh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&yh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(wh(e,t)&&wh(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(vh(e.prev,e,t.prev)||vh(e,t.prev,t))||gh(e,t)&&vh(e.prev,e,e.next)>0&&vh(t.prev,t,t.next)>0)}function vh(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function gh(e,t){return e.x===t.x&&e.y===t.y}function yh(e,t,n,i){var r=bh(vh(e,t,n)),o=bh(vh(e,t,i)),a=bh(vh(n,i,e)),s=bh(vh(n,i,t));return r!==o&&a!==s||(!(0!==r||!xh(e,n,t))||(!(0!==o||!xh(e,i,t))||(!(0!==a||!xh(n,e,i))||!(0!==s||!xh(n,t,i)))))}function xh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function bh(e){return e>0?1:e<0?-1:0}function wh(e,t){return vh(e.prev,e,e.next)<0?vh(e,t,e.next)>=0&&vh(e,e.prev,t)>=0:vh(e,t,e.prev)<0||vh(e,e.next,t)<0}function _h(e,t){var n=new Sh(e.i,e.x,e.y),i=new Sh(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function Mh(e,t,n,i){var r=new Sh(e,t,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 Eh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Sh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ah={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return Ah.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];Th(e),Ph(n,e);var o=e.length;t.forEach(Th);for(var a=0;a<t.length;a++)i.push(o),o+=t[a].length,Ph(n,t[a]);var s=th(n,i);for(a=0;a<s.length;a+=3)r.push(s.slice(a,a+3));return r}};function Th(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Ph(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Lh(e,t){ca.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Ch(e,t)),this.mergeVertices()}function Ch(e,t){Bo.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,i=[],r=[],o=0,a=e.length;o<a;o++){s(e[o])}function s(e){var o=[],a=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:Ih;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);var v,g,y,x,b,w,_,M,E=!1;f&&(v=f.getSpacedPoints(s),E=!0,c=!1,g=f.computeFrenetFrames(s,!1),y=new qi,x=new qi,b=new qi),c||(d=0,h=0,u=0,p=0);var S=e.extractPoints(a),A=S.shape,T=S.holes;if(!Ah.isClockWise(A))for(A=A.reverse(),_=0,M=T.length;_<M;_++)w=T[_],Ah.isClockWise(w)&&(T[_]=w.reverse());var P=Ah.triangulateShape(A,T),L=A;for(_=0,M=T.length;_<M;_++)w=T[_],A=A.concat(w);function C(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var I,R,O,D,N,F,z=A.length,B=P.length;function k(e,t,n){var i,r,o,a=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=a*a+s*s,u=a*c-s*l;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(l*l+c*c),f=t.x-s/p,m=t.y+a/p,v=((n.x-c/d-f)*c-(n.y+l/d-m)*l)/(a*c-s*l),g=(i=f+a*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new Ni(i,r);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?l>Number.EPSILON&&(y=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,r=a,o=Math.sqrt(h)):(i=a,r=s,o=Math.sqrt(h/2))}return new Ni(i/o,r/o)}for(var H=[],U=0,G=L.length,j=G-1,V=U+1;U<G;U++,j++,V++)j===G&&(j=0),V===G&&(V=0),H[U]=k(L[U],L[j],L[V]);var W,q,X=[],Y=H.concat();for(_=0,M=T.length;_<M;_++){for(w=T[_],W=[],U=0,j=(G=w.length)-1,V=U+1;U<G;U++,j++,V++)j===G&&(j=0),V===G&&(V=0),W[U]=k(w[U],w[j],w[V]);X.push(W),Y=Y.concat(W)}for(I=0;I<d;I++){for(O=I/d,D=h*Math.cos(O*Math.PI/2),R=u*Math.sin(O*Math.PI/2)+p,U=0,G=L.length;U<G;U++)Z((N=C(L[U],H[U],R)).x,N.y,-D);for(_=0,M=T.length;_<M;_++)for(w=T[_],W=X[_],U=0,G=w.length;U<G;U++)Z((N=C(w[U],W[U],R)).x,N.y,-D)}for(R=u+p,U=0;U<z;U++)N=c?C(A[U],Y[U],R):A[U],E?(x.copy(g.normals[0]).multiplyScalar(N.x),y.copy(g.binormals[0]).multiplyScalar(N.y),b.copy(v[0]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,0);for(q=1;q<=s;q++)for(U=0;U<z;U++)N=c?C(A[U],Y[U],R):A[U],E?(x.copy(g.normals[q]).multiplyScalar(N.x),y.copy(g.binormals[q]).multiplyScalar(N.y),b.copy(v[q]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,l/s*q);for(I=d-1;I>=0;I--){for(O=I/d,D=h*Math.cos(O*Math.PI/2),R=u*Math.sin(O*Math.PI/2)+p,U=0,G=L.length;U<G;U++)Z((N=C(L[U],H[U],R)).x,N.y,l+D);for(_=0,M=T.length;_<M;_++)for(w=T[_],W=X[_],U=0,G=w.length;U<G;U++)N=C(w[U],W[U],R),E?Z(N.x,N.y+v[s-1].y,v[s-1].x+D):Z(N.x,N.y,l+D)}function Q(e,t){var n,i;for(U=e.length;--U>=0;){n=U,(i=U-1)<0&&(i=e.length-1);var r=0,o=s+2*d;for(r=0;r<o;r++){var a=z*r,l=z*(r+1);K(t+n+a,t+i+a,t+i+l,t+n+l)}}}function Z(e,t,n){o.push(e),o.push(t),o.push(n)}function J(e,t,r){$(e),$(t),$(r);var o=i.length/3,a=m.generateTopUV(n,i,o-3,o-2,o-1);ee(a[0]),ee(a[1]),ee(a[2])}function K(e,t,r,o){$(e),$(t),$(o),$(t),$(r),$(o);var a=i.length/3,s=m.generateSideWallUV(n,i,a-6,a-3,a-2,a-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){i.push(o[3*e+0]),i.push(o[3*e+1]),i.push(o[3*e+2])}function ee(e){r.push(e.x),r.push(e.y)}!function(){var e=i.length/3;if(c){var t=0,r=z*t;for(U=0;U<B;U++)J((F=P[U])[2]+r,F[1]+r,F[0]+r);for(r=z*(t=s+2*d),U=0;U<B;U++)J((F=P[U])[0]+r,F[1]+r,F[2]+r)}else{for(U=0;U<B;U++)J((F=P[U])[2],F[1],F[0]);for(U=0;U<B;U++)J((F=P[U])[0]+z*s,F[1]+z*s,F[2]+z*s)}n.addGroup(e,i.length/3-e,0)}(),function(){var e=i.length/3,t=0;for(Q(L,t),t+=L.length,_=0,M=T.length;_<M;_++)Q(w=T[_],t),t+=w.length;n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new To(i,3)),this.setAttribute("uv",new To(r,2)),this.computeVertexNormals()}Lh.prototype=Object.create(ca.prototype),Lh.prototype.constructor=Lh,Lh.prototype.toJSON=function(){var e=ca.prototype.toJSON.call(this);return Rh(this.parameters.shapes,this.parameters.options,e)},Ch.prototype=Object.create(Bo.prototype),Ch.prototype.constructor=Ch,Ch.prototype.toJSON=function(){var e=Bo.prototype.toJSON.call(this);return Rh(this.parameters.shapes,this.parameters.options,e)};var Ih={generateTopUV:function(e,t,n,i,r){var o=t[3*n],a=t[3*n+1],s=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new Ni(o,a),new Ni(s,l),new Ni(c,h)]},generateSideWallUV:function(e,t,n,i,r,o){var a=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],u=t[3*i+2],p=t[3*r],d=t[3*r+1],f=t[3*r+2],m=t[3*o],v=t[3*o+1],g=t[3*o+2];return Math.abs(s-h)<.01?[new Ni(a,1-l),new Ni(c,1-u),new Ni(p,1-f),new Ni(m,1-g)]:[new Ni(s,1-l),new Ni(h,1-u),new Ni(d,1-f),new Ni(v,1-g)]}};function Rh(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var o=e[i];n.shapes.push(o.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Oh(e,t){ca.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Dh(e,t)),this.mergeVertices()}function Dh(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ca;var i=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Ch.call(this,i,t),this.type="TextBufferGeometry"}function Nh(e,t,n,i,r,o,a){ca.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Fh(e,t,n,i,r,o,a)),this.mergeVertices()}function Fh(e,t,n,i,r,o,a){Bo.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,l,c=Math.min(o+a,Math.PI),h=0,u=[],p=new qi,d=new qi,f=[],m=[],v=[],g=[];for(l=0;l<=n;l++){var y=[],x=l/n,b=0;for(0==l&&0==o?b=.5/t:l==n&&c==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var w=s/t;p.x=-e*Math.cos(i+w*r)*Math.sin(o+x*a),p.y=e*Math.cos(o+x*a),p.z=e*Math.sin(i+w*r)*Math.sin(o+x*a),m.push(p.x,p.y,p.z),d.copy(p).normalize(),v.push(d.x,d.y,d.z),g.push(w+b,1-x),y.push(h++)}u.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var _=u[l][s+1],M=u[l][s],E=u[l+1][s],S=u[l+1][s+1];(0!==l||o>0)&&f.push(_,M,S),(l!==n-1||c<Math.PI)&&f.push(M,E,S)}this.setIndex(f),this.setAttribute("position",new To(m,3)),this.setAttribute("normal",new To(v,3)),this.setAttribute("uv",new To(g,2))}function zh(e,t,n,i,r,o){ca.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new Bh(e,t,n,i,r,o)),this.mergeVertices()}function Bh(e,t,n,i,r,o){Bo.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},e=e||.5,t=t||1,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var a,s,l,c=[],h=[],u=[],p=[],d=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new qi,v=new Ni;for(s=0;s<=i;s++){for(l=0;l<=n;l++)a=r+l/n*o,m.x=d*Math.cos(a),m.y=d*Math.sin(a),h.push(m.x,m.y,m.z),u.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,p.push(v.x,v.y);d+=f}for(s=0;s<i;s++){var g=s*(n+1);for(l=0;l<n;l++){var y=a=l+g,x=a+n+1,b=a+n+2,w=a+1;c.push(y,x,w),c.push(x,b,w)}}this.setIndex(c),this.setAttribute("position",new To(h,3)),this.setAttribute("normal",new To(u,3)),this.setAttribute("uv",new To(p,2))}function kh(e,t,n,i){ca.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new Hh(e,t,n,i)),this.mergeVertices()}function Hh(e,t,n,i){Bo.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=Di.clamp(i,0,2*Math.PI);var r,o,a,s=[],l=[],c=[],h=1/t,u=new qi,p=new Ni;for(o=0;o<=t;o++){var d=n+o*h*i,f=Math.sin(d),m=Math.cos(d);for(a=0;a<=e.length-1;a++)u.x=e[a].x*f,u.y=e[a].y,u.z=e[a].x*m,l.push(u.x,u.y,u.z),p.x=o/t,p.y=a/(e.length-1),c.push(p.x,p.y)}for(o=0;o<t;o++)for(a=0;a<e.length-1;a++){var v=r=a+o*e.length,g=r+e.length,y=r+e.length+1,x=r+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute("position",new To(l,3)),this.setAttribute("uv",new To(c,2)),this.computeVertexNormals(),i===2*Math.PI){var b=this.attributes.normal.array,w=new qi,_=new qi,M=new qi;for(r=t*e.length*3,o=0,a=0;o<e.length;o++,a+=3)w.x=b[a+0],w.y=b[a+1],w.z=b[a+2],_.x=b[r+a+0],_.y=b[r+a+1],_.z=b[r+a+2],M.addVectors(w,_).normalize(),b[a+0]=b[r+a+0]=M.x,b[a+1]=b[r+a+1]=M.y,b[a+2]=b[r+a+2]=M.z}}function Uh(e,t){ca.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Gh(e,t)),this.mergeVertices()}function Gh(e,t){Bo.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],o=[],a=0,s=0;if(!1===Array.isArray(e))c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(a,s,l),a+=s,s=0;function c(e){var a,l,c,h=i.length/3,u=e.extractPoints(t),p=u.shape,d=u.holes;for(!1===Ah.isClockWise(p)&&(p=p.reverse()),a=0,l=d.length;a<l;a++)c=d[a],!0===Ah.isClockWise(c)&&(d[a]=c.reverse());var f=Ah.triangulateShape(p,d);for(a=0,l=d.length;a<l;a++)c=d[a],p=p.concat(c);for(a=0,l=p.length;a<l;a++){var m=p[a];i.push(m.x,m.y,0),r.push(0,0,1),o.push(m.x,m.y)}for(a=0,l=f.length;a<l;a++){var v=f[a],g=v[0]+h,y=v[1]+h,x=v[2]+h;n.push(g,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new To(i,3)),this.setAttribute("normal",new To(r,3)),this.setAttribute("uv",new To(o,2))}function jh(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Vh(e,t){Bo.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,o,a=[],s=Math.cos(Di.DEG2RAD*t),l=[0,0],c={},h=["a","b","c"];e.isBufferGeometry?(o=new ca).fromBufferGeometry(e):o=e.clone(),o.mergeVertices(),o.computeFaceNormals();for(var u=o.vertices,p=o.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)n=m[h[v]],i=m[h[(v+1)%3]],l[0]=Math.min(n,i),l[1]=Math.max(n,i),void 0===c[r=l[0]+","+l[1]]?c[r]={index1:l[0],index2:l[1],face1:d,face2:void 0}:c[r].face2=d;for(r in c){var g=c[r];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=u[g.index1];a.push(y.x,y.y,y.z),y=u[g.index2],a.push(y.x,y.y,y.z)}}this.setAttribute("position",new To(a,3))}function Wh(e,t,n,i,r,o,a,s){ca.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new qh(e,t,n,i,r,o,a,s)),this.mergeVertices()}function qh(e,t,n,i,r,o,a,s){Bo.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s};var l=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var c=[],h=[],u=[],p=[],d=0,f=[],m=n/2,v=0;function g(n){var r,o,f,g=new Ni,y=new qi,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(o=d,r=1;r<=i;r++)h.push(0,m*w,0),u.push(0,w,0),p.push(.5,.5),d++;for(f=d,r=0;r<=i;r++){var _=r/i*s+a,M=Math.cos(_),E=Math.sin(_);y.x=b*E,y.y=m*w,y.z=b*M,h.push(y.x,y.y,y.z),u.push(0,w,0),g.x=.5*M+.5,g.y=.5*E*w+.5,p.push(g.x,g.y),d++}for(r=0;r<i;r++){var S=o+r,A=f+r;!0===n?c.push(A,A+1,S):c.push(A+1,A,S),x+=3}l.addGroup(v,x,!0===n?1:2),v+=x}!function(){var o,g,y=new qi,x=new qi,b=0,w=(t-e)/n;for(g=0;g<=r;g++){var _=[],M=g/r,E=M*(t-e)+e;for(o=0;o<=i;o++){var S=o/i,A=S*s+a,T=Math.sin(A),P=Math.cos(A);x.x=E*T,x.y=-M*n+m,x.z=E*P,h.push(x.x,x.y,x.z),y.set(T,w,P).normalize(),u.push(y.x,y.y,y.z),p.push(S,1-M),_.push(d++)}f.push(_)}for(o=0;o<i;o++)for(g=0;g<r;g++){var L=f[g][o],C=f[g+1][o],I=f[g+1][o+1],R=f[g][o+1];c.push(L,C,R),c.push(C,I,R),b+=6}l.addGroup(v,b,0),v+=b}(),!1===o&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new To(h,3)),this.setAttribute("normal",new To(u,3)),this.setAttribute("uv",new To(p,2))}function Xh(e,t,n,i,r,o,a){Wh.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Yh(e,t,n,i,r,o,a){qh.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Qh(e,t,n,i){ca.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new Zh(e,t,n,i)),this.mergeVertices()}function Zh(e,t,n,i){Bo.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],l=[],c=[],h=new qi,u=new Ni;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),o=0,r=3;o<=t;o++,r+=3){var p=n+o/t*i;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),l.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,c.push(u.x,u.y)}for(r=1;r<=t;r++)a.push(r,r+1,0);this.setIndex(a),this.setAttribute("position",new To(s,3)),this.setAttribute("normal",new To(l,3)),this.setAttribute("uv",new To(c,2))}Oh.prototype=Object.create(ca.prototype),Oh.prototype.constructor=Oh,Dh.prototype=Object.create(Ch.prototype),Dh.prototype.constructor=Dh,Nh.prototype=Object.create(ca.prototype),Nh.prototype.constructor=Nh,Fh.prototype=Object.create(Bo.prototype),Fh.prototype.constructor=Fh,zh.prototype=Object.create(ca.prototype),zh.prototype.constructor=zh,Bh.prototype=Object.create(Bo.prototype),Bh.prototype.constructor=Bh,kh.prototype=Object.create(ca.prototype),kh.prototype.constructor=kh,Hh.prototype=Object.create(Bo.prototype),Hh.prototype.constructor=Hh,Uh.prototype=Object.create(ca.prototype),Uh.prototype.constructor=Uh,Uh.prototype.toJSON=function(){var e=ca.prototype.toJSON.call(this);return jh(this.parameters.shapes,e)},Gh.prototype=Object.create(Bo.prototype),Gh.prototype.constructor=Gh,Gh.prototype.toJSON=function(){var e=Bo.prototype.toJSON.call(this);return jh(this.parameters.shapes,e)},Vh.prototype=Object.create(Bo.prototype),Vh.prototype.constructor=Vh,Wh.prototype=Object.create(ca.prototype),Wh.prototype.constructor=Wh,qh.prototype=Object.create(Bo.prototype),qh.prototype.constructor=qh,Xh.prototype=Object.create(Wh.prototype),Xh.prototype.constructor=Xh,Yh.prototype=Object.create(qh.prototype),Yh.prototype.constructor=Yh,Qh.prototype=Object.create(ca.prototype),Qh.prototype.constructor=Qh,Zh.prototype=Object.create(Bo.prototype),Zh.prototype.constructor=Zh;var Jh=Object.freeze({__proto__:null,WireframeGeometry:Fc,ParametricGeometry:zc,ParametricBufferGeometry:Bc,TetrahedronGeometry:Uc,TetrahedronBufferGeometry:Gc,OctahedronGeometry:jc,OctahedronBufferGeometry:Vc,IcosahedronGeometry:Wc,IcosahedronBufferGeometry:qc,DodecahedronGeometry:Xc,DodecahedronBufferGeometry:Yc,PolyhedronGeometry:kc,PolyhedronBufferGeometry:Hc,TubeGeometry:Qc,TubeBufferGeometry:Zc,TorusKnotGeometry:Jc,TorusKnotBufferGeometry:Kc,TorusGeometry:$c,TorusBufferGeometry:eh,TextGeometry:Oh,TextBufferGeometry:Dh,SphereGeometry:Nh,SphereBufferGeometry:Fh,RingGeometry:zh,RingBufferGeometry:Bh,PlaneGeometry:Ta,PlaneBufferGeometry:Pa,LatheGeometry:kh,LatheBufferGeometry:Hh,ShapeGeometry:Uh,ShapeBufferGeometry:Gh,ExtrudeGeometry:Lh,ExtrudeBufferGeometry:Ch,EdgesGeometry:Vh,ConeGeometry:Xh,ConeBufferGeometry:Yh,CylinderGeometry:Wh,CylinderBufferGeometry:qh,CircleGeometry:Qh,CircleBufferGeometry:Zh,BoxGeometry:class extends ca{constructor(e,t,n,i,r,o){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new ha(e,t,n,i,r,o)),this.mergeVertices()}},BoxBufferGeometry:ha});function Kh(e){vo.call(this),this.type="ShadowMaterial",this.color=new co(0),this.transparent=!0,this.setValues(e)}function $h(e){fa.call(this,e),this.type="RawShaderMaterial"}function eu(e){vo.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new co(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 co(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ni(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function tu(e){eu.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ni(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function nu(e){vo.call(this),this.type="MeshPhongMaterial",this.color=new co(16777215),this.specular=new co(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new co(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ni(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function iu(e){vo.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new co(16777215),this.specular=new co(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new co(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ni(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ru(e){vo.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ni(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ou(e){vo.call(this),this.type="MeshLambertMaterial",this.color=new co(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new co(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function au(e){vo.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new co(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ni(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function su(e){fc.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Kh.prototype=Object.create(vo.prototype),Kh.prototype.constructor=Kh,Kh.prototype.isShadowMaterial=!0,Kh.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this},$h.prototype=Object.create(fa.prototype),$h.prototype.constructor=$h,$h.prototype.isRawShaderMaterial=!0,eu.prototype=Object.create(vo.prototype),eu.prototype.constructor=eu,eu.prototype.isMeshStandardMaterial=!0,eu.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},tu.prototype=Object.create(eu.prototype),tu.prototype.constructor=tu,tu.prototype.isMeshPhysicalMaterial=!0,tu.prototype.copy=function(e){return eu.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new co).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},nu.prototype=Object.create(vo.prototype),nu.prototype.constructor=nu,nu.prototype.isMeshPhongMaterial=!0,nu.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},iu.prototype=Object.create(vo.prototype),iu.prototype.constructor=iu,iu.prototype.isMeshToonMaterial=!0,iu.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ru.prototype=Object.create(vo.prototype),ru.prototype.constructor=ru,ru.prototype.isMeshNormalMaterial=!0,ru.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ou.prototype=Object.create(vo.prototype),ou.prototype.constructor=ou,ou.prototype.isMeshLambertMaterial=!0,ou.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},au.prototype=Object.create(vo.prototype),au.prototype.constructor=au,au.prototype.isMeshMatcapMaterial=!0,au.prototype.copy=function(e){return vo.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},su.prototype=Object.create(fc.prototype),su.prototype.constructor=su,su.prototype.isLineDashedMaterial=!0,su.prototype.copy=function(e){return fc.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var lu=Object.freeze({__proto__:null,ShadowMaterial:Kh,SpriteMaterial:Nl,RawShaderMaterial:$h,ShaderMaterial:fa,PointsMaterial:Sc,MeshPhysicalMaterial:tu,MeshStandardMaterial:eu,MeshPhongMaterial:nu,MeshToonMaterial:iu,MeshNormalMaterial:ru,MeshLambertMaterial:ou,MeshDepthMaterial:gl,MeshDistanceMaterial:yl,MeshBasicMaterial:go,MeshMatcapMaterial:au,LineDashedMaterial:su,LineBasicMaterial:fc,Material:vo}),cu={arraySlice:function(e,t,n){return cu.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*t,l=0;l!==t;++l)r[a++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(t.push(o.time),n.push.apply(n,a)),o=e[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(t.push(o.time),a.toArray(n,n.length)),o=e[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(t.push(o.time),n.push(a)),o=e[r++]}while(void 0!==o)}},subclip:function(e,t,n,i,r){r=r||30;var o=e.clone();o.name=t;for(var a=[],s=0;s<o.tracks.length;++s){for(var l=o.tracks[s],c=l.getValueSize(),h=[],u=[],p=0;p<l.times.length;++p){var d=l.times[p]*r;if(!(d<n||d>=i)){h.push(l.times[p]);for(var f=0;f<c;++f)u.push(l.values[p*c+f])}}0!==h.length&&(l.times=cu.convertArray(h,l.times.constructor),l.values=cu.convertArray(u,l.values.constructor),a.push(l))}o.tracks=a;var m=1/0;for(s=0;s<o.tracks.length;++s)m>o.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(s=0;s<o.tracks.length;++s)o.tracks[s].shift(-1*m);return o.resetDuration(),o},makeClipAdditive:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===i||i<=0)&&(i=30);for(var r=e.tracks.length,o=t/i,a=0;a<r;++a){var s=n.tracks[a],l=s.ValueTypeName;if("bool"!==l&&"string"!==l){var c=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===l}));if(void 0!==c){var h,u=s.getValueSize(),p=s.times.length-1;if(o<=s.times[0])h=cu.arraySlice(s.values,0,s.valueSize);else if(o>=s.times[p]){var d=p*u;h=cu.arraySlice(s.values,d)}else{var f=s.createInterpolant();f.evaluate(o),h=f.resultBuffer}if("quaternion"===l)new ji(h[0],h[1],h[2],h[3]).normalize().conjugate().toArray(h);for(var m=c.times.length,v=0;v<m;++v){var g=v*u;if("quaternion"===l)ji.multiplyQuaternionsFlat(c.values,g,h,0,c.values,g);else for(var y=0;y<u;++y)c.values[g+y]-=h[y]}}}}return e.blendMode=2501,e}};function hu(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function uu(e,t,n,i){hu.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function pu(e,t,n,i){hu.call(this,e,t,n,i)}function du(e,t,n,i){hu.call(this,e,t,n,i)}function fu(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=cu.convertArray(t,this.TimeBufferType),this.values=cu.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function mu(e,t,n){fu.call(this,e,t,n)}function vu(e,t,n,i){fu.call(this,e,t,n,i)}function gu(e,t,n,i){fu.call(this,e,t,n,i)}function yu(e,t,n,i){hu.call(this,e,t,n,i)}function xu(e,t,n,i){fu.call(this,e,t,n,i)}function bu(e,t,n,i){fu.call(this,e,t,n,i)}function wu(e,t,n,i){fu.call(this,e,t,n,i)}function _u(e,t,n,i){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==i?i:Ei,this.uuid=Di.generateUUID(),this.duration<0&&this.resetDuration()}function Mu(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return gu;case"vector":case"vector2":case"vector3":case"vector4":return wu;case"color":return vu;case"quaternion":return xu;case"bool":case"boolean":return mu;case"string":return bu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];cu.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(hu.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var o;n:{i:if(!(e<i)){for(var a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===a)break;if(r=i,e<(i=t[++n]))break t}o=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===a)break;if(i=r,e>=(r=t[--n-1]))break t}o=n,n=0}for(;n<o;){var l=n+o>>>1;e<t[l]?o=l:n=l+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,o=0;o!==i;++o)t[o]=n[r+o];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(hu.prototype,{beforeStart_:hu.prototype.copySampleValue_,afterEnd_:hu.prototype.copySampleValue_}),uu.prototype=Object.assign(Object.create(hu.prototype),{constructor:uu,DefaultSettings_:{endingStart:wi,endingEnd:wi},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,o=e+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case _i:r=e,a=2*t-n;break;case Mi:a=t+i[r=i.length-2]-i[r+1];break;default:r=e,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case _i:o=e,s=2*n-t;break;case Mi:o=1,s=n+i[1]-i[0];break;default:o=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=o*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=s-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-t)/(i-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==a;++b)r[b]=v*o[c+b]+g*o[l+b]+y*o[s+b]+x*o[h+b];return r}}),pu.prototype=Object.assign(Object.create(hu.prototype),{constructor:pu,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=s-a,c=(n-t)/(i-t),h=1-c,u=0;u!==a;++u)r[u]=o[l+u]*h+o[s+u]*c;return r}}),du.prototype=Object.assign(Object.create(hu.prototype),{constructor:du,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(fu,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:cu.convertArray(e.times,Array),values:cu.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),Object.assign(fu.prototype,{constructor:fu,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:xi,InterpolantFactoryMethodDiscrete:function(e){return new du(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new pu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new uu(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case yi:t=this.InterpolantFactoryMethodDiscrete;break;case xi:t=this.InterpolantFactoryMethodLinear;break;case bi:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return yi;case this.InterpolantFactoryMethodLinear:return xi;case this.InterpolantFactoryMethodSmooth:return bi}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<e;)++r;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=cu.arraySlice(n,r,o),this.values=cu.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&cu.isTypedArray(i)){a=0;for(var l=i.length;a!==l;++a){var c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}}return e},optimize:function(){for(var e=cu.arraySlice(this.times),t=cu.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===bi,r=1,o=e.length-1,a=1;a<o;++a){var s=!1,l=e[a];if(l!==e[a+1]&&(1!==a||l!==l[0]))if(i)s=!0;else for(var c=a*n,h=c-n,u=c+n,p=0;p!==n;++p){var d=t[c+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(a!==r){e[r]=e[a];var f=a*n,m=r*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++r}}if(o>0){e[r]=e[o];for(f=o*n,m=r*n,p=0;p!==n;++p)t[m+p]=t[f+p];++r}return r!==e.length?(this.times=cu.arraySlice(e,0,r),this.values=cu.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=cu.arraySlice(this.times,0),t=cu.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),mu.prototype=Object.assign(Object.create(fu.prototype),{constructor:mu,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:yi,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),vu.prototype=Object.assign(Object.create(fu.prototype),{constructor:vu,ValueTypeName:"color"}),gu.prototype=Object.assign(Object.create(fu.prototype),{constructor:gu,ValueTypeName:"number"}),yu.prototype=Object.assign(Object.create(hu.prototype),{constructor:yu,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(i-t),c=s+a;s!==c;s+=4)ji.slerpFlat(r,0,o,s-a,o,s,l);return r}}),xu.prototype=Object.assign(Object.create(fu.prototype),{constructor:xu,ValueTypeName:"quaternion",DefaultInterpolation:xi,InterpolantFactoryMethodLinear:function(e){return new yu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),bu.prototype=Object.assign(Object.create(fu.prototype),{constructor:bu,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:yi,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),wu.prototype=Object.assign(Object.create(fu.prototype),{constructor:wu,ValueTypeName:"vector"}),Object.assign(_u,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,o=n.length;r!==o;++r)t.push(Mu(n[r]).scale(i));return new _u(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,o=n.length;r!==o;++r)t.push(fu.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,o=[],a=0;a<r;a++){var s=[],l=[];s.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);var c=cu.getKeyframeOrder(s);s=cu.sortedArray(s,1,c),l=cu.sortedArray(l,1,c),i||0!==s[0]||(s.push(r),l.push(l[0])),o.push(new gu(".morphTargetInfluences["+t[a].name+"]",s,l).scale(1/n))}return new _u(e,-1,o)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;o<a;o++){var s=e[o],l=s.name.match(r);if(l&&l.length>1){var c=i[u=l[1]];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var u in i)h.push(_u.CreateFromMorphTargetSequence(u,i[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var o=[],a=[];cu.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.blendMode,l=e.hierarchy||[],c=0;c<l.length;c++){var h=l[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)u[h[p].morphTargets[d]]=-1;for(var f in u){var m=[],v=[];for(d=0;d!==h[p].morphTargets.length;++d){var g=h[p];m.push(g.time),v.push(g.morphTarget===f?1:0)}i.push(new gu(".morphTargetInfluence["+f+"]",m,v))}o=u.length*(a||1)}else{var y=".bones["+t[c].name+"]";n(wu,y+".position",h,"pos",i),n(xu,y+".quaternion",h,"rot",i),n(wu,y+".scale",h,"scl",i)}}return 0===i.length?null:new _u(r,o,i,s)}}),Object.assign(_u.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new _u(this.name,this.duration,e,this.blendMode)}});var Eu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Su(e,t,n){var i=this,r=!1,o=0,a=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===r&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=l.length;t<n;t+=2){var i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}var Au=new Su;function Tu(e){this.manager=void 0!==e?e:Au,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Tu.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var Pu={};function Lu(e){Tu.call(this,e)}function Cu(e){Tu.call(this,e)}function Iu(e){Tu.call(this,e)}function Ru(e){Tu.call(this,e)}function Ou(e){Tu.call(this,e)}function Du(e){Tu.call(this,e)}function Nu(e){Tu.call(this,e)}function Fu(){this.type="Curve",this.arcLengthDivisions=200}function zu(e,t,n,i,r,o,a,s){Fu.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function Bu(e,t,n,i,r,o){zu.call(this,e,t,n,n,i,r,o),this.type="ArcCurve"}function ku(){var e=0,t=0,n=0,i=0;function r(r,o,a,s){e=r,t=a,n=-3*r+3*o-2*a-s,i=2*r-2*o+a+s}return{initCatmullRom:function(e,t,n,i,o){r(t,n,o*(n-e),o*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,o,a,s){var l=(t-e)/o-(n-e)/(o+a)+(n-t)/a,c=(n-t)/a-(i-t)/(a+s)+(i-n)/s;r(t,n,l*=a,c*=a)},calc:function(r){var o=r*r;return e+t*r+n*o+i*(o*r)}}}Lu.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Lu,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Eu.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;if(void 0===Pu[e]){var a=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],l=!!a[2],c=a[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h="blob"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(c,s);break;case"json":h=JSON.parse(c);break;default:h=c}setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(g){setTimeout((function(){i&&i(g),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{Pu[e]=[],Pu[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;for(var v in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,i=Pu[e];if(delete Pu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Eu.add(e,n);for(var o=0,a=i.length;o<a;o++){(s=i[o]).onLoad&&s.onLoad(n)}r.manager.itemEnd(e)}else{for(o=0,a=i.length;o<a;o++){var s;(s=i[o]).onError&&s.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=Pu[e],i=0,r=n.length;i<r;i++){var o=n[i];o.onProgress&&o.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=Pu[e];delete Pu[e];for(var i=0,o=n.length;i<o;i++){var a=n[i];a.onError&&a.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=Pu[e];delete Pu[e];for(var i=0,o=n.length;i<o;i++){var a=n[i];a.onError&&a.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return r.manager.itemStart(e),m}Pu[e].push({onLoad:t,onProgress:n,onError:i})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Cu.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Cu,load:function(e,t,n,i){var r=this,o=new Lu(r.manager);o.setPath(r.path),o.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(e)}}),n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=_u.parse(e[n]);t.push(i)}return t}}),Iu.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Iu,load:function(e,t,n,i){var r=this,o=[],a=new Oc;a.image=o;var s=new Lu(this.manager);function l(l){s.load(e[l],(function(e){var n=r.parse(e,!0);o[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(a.minFilter=ai),a.format=n.format,a.needsUpdate=!0,t&&t(a))}),n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,h=0,u=e.length;h<u;++h)l(h);else s.load(e,(function(e){var n=r.parse(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){o[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=ai),a.format=n.format,a.needsUpdate=!0,t&&t(a)}),n,i);return a}}),Ru.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Ru,load:function(e,t,n,i){var r=this,o=new ba,a=new Lu(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(e,(function(e){var n=r.parse(e);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:ti,o.wrapT=void 0!==n.wrapT?n.wrapT:ti,o.magFilter=void 0!==n.magFilter?n.magFilter:ai,o.minFilter=void 0!==n.minFilter?n.minFilter:ai,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=si),1===n.mipmapCount&&(o.minFilter=ai),o.needsUpdate=!0,t&&t(o,n))}),n,i),o}}),Ou.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Ou,load:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Eu.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),Eu.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}),Du.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Du,load:function(e,t,n,i){var r=new Ga,o=new Ou(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(n){o.load(e[n],(function(e){r.images[n]=e,6===++a&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(var l=0;l<e.length;++l)s(l);return r}}),Nu.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Nu,load:function(e,t,n,i){var r=new ki,o=new Ou(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(n){r.image=n;var i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?fi:mi,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(Fu.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=e;n++)o+=(t=this.getPoint(n/e)).distanceTo(r),i.push(o),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,o=i.length;n=t||e*i[o-1];for(var a,s=0,l=o-1;s<=l;)if((a=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(o-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(o-1)},getTangent:function(e,t){var n=1e-4,i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);var o=this.getPoint(i),a=this.getPoint(r),s=t||(o.isVector2?new Ni:new qi);return s.copy(a).sub(o).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,i,r,o=new qi,a=[],s=[],l=[],c=new qi,h=new er;for(n=0;n<=e;n++)i=n/e,a[n]=this.getTangentAt(i,new qi),a[n].normalize();s[0]=new qi,l[0]=new qi;var u=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=u&&(u=p,o.set(1,0,0)),d<=u&&(u=d,o.set(0,1,0)),f<=u&&o.set(0,0,1),c.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],c),l[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(a[n-1],a[n]),c.length()>Number.EPSILON&&(c.normalize(),r=Math.acos(Di.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(c,r))),l[n].crossVectors(a[n],s[n]);if(!0===t)for(r=Math.acos(Di.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(c.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(a[n],r*n)),l[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),zu.prototype=Object.create(Fu.prototype),zu.prototype.constructor=zu,zu.prototype.isEllipseCurve=!0,zu.prototype.getPoint=function(e,t){for(var n=t||new Ni,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r===i?r=-i:r-=i);var a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=l-this.aY;s=u*c-p*h+this.aX,l=u*h+p*c+this.aY}return n.set(s,l)},zu.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},zu.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},zu.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Bu.prototype=Object.create(zu.prototype),Bu.prototype.constructor=Bu,Bu.prototype.isArcCurve=!0;var Hu=new qi,Uu=new ku,Gu=new ku,ju=new ku;function Vu(e,t,n,i){Fu.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function Wu(e,t,n,i,r){var o=.5*(i-t),a=.5*(r-n),s=e*e;return(2*n-2*i+o+a)*(e*s)+(-3*n+3*i-2*o-a)*s+o*e+n}function qu(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function Xu(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function Yu(e,t,n,i){Fu.call(this),this.type="CubicBezierCurve",this.v0=e||new Ni,this.v1=t||new Ni,this.v2=n||new Ni,this.v3=i||new Ni}function Qu(e,t,n,i){Fu.call(this),this.type="CubicBezierCurve3",this.v0=e||new qi,this.v1=t||new qi,this.v2=n||new qi,this.v3=i||new qi}function Zu(e,t){Fu.call(this),this.type="LineCurve",this.v1=e||new Ni,this.v2=t||new Ni}function Ju(e,t){Fu.call(this),this.type="LineCurve3",this.v1=e||new qi,this.v2=t||new qi}function Ku(e,t,n){Fu.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Ni,this.v1=t||new Ni,this.v2=n||new Ni}function $u(e,t,n){Fu.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new qi,this.v1=t||new qi,this.v2=n||new qi}function ep(e){Fu.call(this),this.type="SplineCurve",this.points=e||[]}Vu.prototype=Object.create(Fu.prototype),Vu.prototype.constructor=Vu,Vu.prototype.isCatmullRomCurve3=!0,Vu.prototype.getPoint=function(e,t){var n,i,r,o,a=t||new qi,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,h=Math.floor(c),u=c-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===u&&h===l-1&&(h=l-2,u=1),this.closed||h>0?n=s[(h-1)%l]:(Hu.subVectors(s[0],s[1]).add(s[0]),n=Hu),i=s[h%l],r=s[(h+1)%l],this.closed||h+2<l?o=s[(h+2)%l]:(Hu.subVectors(s[l-1],s[l-2]).add(s[l-1]),o=Hu),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(i),p),f=Math.pow(i.distanceToSquared(r),p),m=Math.pow(r.distanceToSquared(o),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),Uu.initNonuniformCatmullRom(n.x,i.x,r.x,o.x,d,f,m),Gu.initNonuniformCatmullRom(n.y,i.y,r.y,o.y,d,f,m),ju.initNonuniformCatmullRom(n.z,i.z,r.z,o.z,d,f,m)}else"catmullrom"===this.curveType&&(Uu.initCatmullRom(n.x,i.x,r.x,o.x,this.tension),Gu.initCatmullRom(n.y,i.y,r.y,o.y,this.tension),ju.initCatmullRom(n.z,i.z,r.z,o.z,this.tension));return a.set(Uu.calc(u),Gu.calc(u),ju.calc(u)),a},Vu.prototype.copy=function(e){Fu.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Vu.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Vu.prototype.fromJSON=function(e){Fu.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new qi).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Yu.prototype=Object.create(Fu.prototype),Yu.prototype.constructor=Yu,Yu.prototype.isCubicBezierCurve=!0,Yu.prototype.getPoint=function(e,t){var n=t||new Ni,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Xu(e,i.x,r.x,o.x,a.x),Xu(e,i.y,r.y,o.y,a.y)),n},Yu.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Yu.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Yu.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Qu.prototype=Object.create(Fu.prototype),Qu.prototype.constructor=Qu,Qu.prototype.isCubicBezierCurve3=!0,Qu.prototype.getPoint=function(e,t){var n=t||new qi,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Xu(e,i.x,r.x,o.x,a.x),Xu(e,i.y,r.y,o.y,a.y),Xu(e,i.z,r.z,o.z,a.z)),n},Qu.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Qu.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Qu.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Zu.prototype=Object.create(Fu.prototype),Zu.prototype.constructor=Zu,Zu.prototype.isLineCurve=!0,Zu.prototype.getPoint=function(e,t){var n=t||new Ni;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Zu.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Zu.prototype.getTangent=function(e,t){return(t||new Ni).copy(this.v2).sub(this.v1).normalize()},Zu.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Zu.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Zu.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ju.prototype=Object.create(Fu.prototype),Ju.prototype.constructor=Ju,Ju.prototype.isLineCurve3=!0,Ju.prototype.getPoint=function(e,t){var n=t||new qi;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Ju.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Ju.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ju.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ju.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ku.prototype=Object.create(Fu.prototype),Ku.prototype.constructor=Ku,Ku.prototype.isQuadraticBezierCurve=!0,Ku.prototype.getPoint=function(e,t){var n=t||new Ni,i=this.v0,r=this.v1,o=this.v2;return n.set(qu(e,i.x,r.x,o.x),qu(e,i.y,r.y,o.y)),n},Ku.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ku.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ku.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},$u.prototype=Object.create(Fu.prototype),$u.prototype.constructor=$u,$u.prototype.isQuadraticBezierCurve3=!0,$u.prototype.getPoint=function(e,t){var n=t||new qi,i=this.v0,r=this.v1,o=this.v2;return n.set(qu(e,i.x,r.x,o.x),qu(e,i.y,r.y,o.y),qu(e,i.z,r.z,o.z)),n},$u.prototype.copy=function(e){return Fu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},$u.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},$u.prototype.fromJSON=function(e){return Fu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ep.prototype=Object.create(Fu.prototype),ep.prototype.constructor=ep,ep.prototype.isSplineCurve=!0,ep.prototype.getPoint=function(e,t){var n=t||new Ni,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,s=i[0===o?o:o-1],l=i[o],c=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Wu(a,s.x,l.x,c.x,h.x),Wu(a,s.y,l.y,c.y,h.y)),n},ep.prototype.copy=function(e){Fu.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},ep.prototype.toJSON=function(){var e=Fu.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},ep.prototype.fromJSON=function(e){Fu.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new Ni).fromArray(i))}return this};var tp=Object.freeze({__proto__:null,ArcCurve:Bu,CatmullRomCurve3:Vu,CubicBezierCurve:Yu,CubicBezierCurve3:Qu,EllipseCurve:zu,LineCurve:Zu,LineCurve3:Ju,QuadraticBezierCurve:Ku,QuadraticBezierCurve3:$u,SplineCurve:ep});function np(){Fu.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ip(e){np.call(this),this.type="Path",this.currentPoint=new Ni,e&&this.setFromPoints(e)}function rp(e){ip.call(this,e),this.uuid=Di.generateUUID(),this.type="Shape",this.holes=[]}function op(e,t){yr.call(this),this.type="Light",this.color=new co(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function ap(e,t,n){op.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(yr.DefaultUp),this.updateMatrix(),this.groundColor=new co(t)}function sp(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Ni(512,512),this.map=null,this.mapPass=null,this.matrix=new er,this._frustum=new Ma,this._frameExtents=new Ni(1,1),this._viewportCount=1,this._viewports=[new Hi(0,0,1,1)]}function lp(){sp.call(this,new va(50,1,.5,500))}function cp(e,t,n,i,r,o){op.call(this,e,t),this.type="SpotLight",this.position.copy(yr.DefaultUp),this.updateMatrix(),this.target=new yr,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new lp}function hp(){sp.call(this,new va(90,1,.5,500)),this._frameExtents=new Ni(4,2),this._viewportCount=6,this._viewports=[new Hi(2,1,1,1),new Hi(0,1,1,1),new Hi(3,1,1,1),new Hi(1,1,1,1),new Hi(3,0,1,1),new Hi(1,0,1,1)],this._cubeDirections=[new qi(1,0,0),new qi(-1,0,0),new qi(0,0,1),new qi(0,0,-1),new qi(0,1,0),new qi(0,-1,0)],this._cubeUps=[new qi(0,1,0),new qi(0,1,0),new qi(0,1,0),new qi(0,1,0),new qi(0,0,1),new qi(0,0,-1)]}function up(e,t,n,i){op.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new hp}function pp(e,t,n,i,r,o){ma.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function dp(){sp.call(this,new pp(-5,5,5,-5,.5,500))}function fp(e,t){op.call(this,e,t),this.type="DirectionalLight",this.position.copy(yr.DefaultUp),this.updateMatrix(),this.target=new yr,this.shadow=new dp}function mp(e,t){op.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function vp(e,t,n,i){op.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function gp(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new qi)}function yp(e,t){op.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new gp}function xp(e){Tu.call(this,e),this.textures={}}np.prototype=Object.assign(Object.create(Fu.prototype),{constructor:np,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Zu(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var o=r[i],a=o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,s=o.getPoints(a),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Fu.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Fu.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){Fu.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new tp[i.type]).fromJSON(i))}return this}}),ip.prototype=Object.assign(Object.create(np.prototype),{constructor:ip,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new Zu(this.currentPoint.clone(),new Ni(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new Ku(this.currentPoint.clone(),new Ni(e,t),new Ni(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,o){var a=new Yu(this.currentPoint.clone(),new Ni(e,t),new Ni(n,i),new Ni(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this},splineThru:function(e){var t=new ep([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+a,t+s,n,i,r,o),this},absarc:function(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this},ellipse:function(e,t,n,i,r,o,a,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,o,a,s),this},absellipse:function(e,t,n,i,r,o,a,s){var l=new zu(e,t,n,i,r,o,a,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var h=l.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return np.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=np.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return np.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),rp.prototype=Object.assign(Object.create(ip.prototype),{constructor:rp,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){ip.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=ip.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){ip.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new ip).fromJSON(i))}return this}}),op.prototype=Object.assign(Object.create(yr.prototype),{constructor:op,isLight:!0,copy:function(e){return yr.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=yr.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),ap.prototype=Object.assign(Object.create(op.prototype),{constructor:ap,isHemisphereLight:!0,copy:function(e){return op.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(sp.prototype,{_projScreenMatrix:new er,_lightPositionWorld:new qi,_lookTarget:new qi,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld),t.position.copy(o),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),lp.prototype=Object.assign(Object.create(sp.prototype),{constructor:lp,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*Di.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),sp.prototype.updateMatrices.call(this,e)}}),cp.prototype=Object.assign(Object.create(op.prototype),{constructor:cp,isSpotLight:!0,copy:function(e){return op.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),hp.prototype=Object.assign(Object.create(sp.prototype),{constructor:hp,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,o=this._lookTarget,a=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),o.copy(n.position),o.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(o),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),a.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a)}}),up.prototype=Object.assign(Object.create(op.prototype),{constructor:up,isPointLight:!0,copy:function(e){return op.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),pp.prototype=Object.assign(Object.create(ma.prototype),{constructor:pp,isOrthographicCamera:!0,copy:function(e,t){return ma.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,o){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,o=n+e,a=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o=(r+=l*this.view.offsetX)+l*this.view.width,s=(a-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=yr.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),dp.prototype=Object.assign(Object.create(sp.prototype),{constructor:dp,isDirectionalLightShadow:!0,updateMatrices:function(e){sp.prototype.updateMatrices.call(this,e)}}),fp.prototype=Object.assign(Object.create(op.prototype),{constructor:fp,isDirectionalLight:!0,copy:function(e){return op.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),mp.prototype=Object.assign(Object.create(op.prototype),{constructor:mp,isAmbientLight:!0}),vp.prototype=Object.assign(Object.create(op.prototype),{constructor:vp,isRectAreaLight:!0,copy:function(e){return op.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=op.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(gp.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*i*1.092548),t.addScaledVector(o[5],i*r*1.092548),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],n*r*1.092548),t.addScaledVector(o[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*i),t.addScaledVector(o[2],1.023328*r),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*i),t.addScaledVector(o[5],.858086*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],.858086*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}),Object.assign(gp,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}),yp.prototype=Object.assign(Object.create(op.prototype),{constructor:yp,isLightProbe:!0,copy:function(e){return op.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=op.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),xp.prototype=Object.assign(Object.create(Tu.prototype),{constructor:xp,load:function(e,t,n,i){var r=this,o=new Lu(r.manager);o.setPath(r.path),o.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new lu[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new co).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=(new co).setHex(o.value);break;case"v2":i.uniforms[r].value=(new Ni).fromArray(o.value);break;case"v3":i.uniforms[r].value=(new qi).fromArray(o.value);break;case"v4":i.uniforms[r].value=(new Hi).fromArray(o.value);break;case"m3":i.uniforms[r].value=(new Fi).fromArray(o.value);case"m4":i.uniforms[r].value=(new er).fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var a in e.extensions)i.extensions[a]=e.extensions[a];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new Ni).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ni).fromArray(e.clearcoatNormalScale)),i},setTextures:function(e){return this.textures=e,this}});var bp=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(r){return t}},wp=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function _p(){Bo.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Mp(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),xo.call(this,e,t,n),this.meshPerAttribute=i||1}function Ep(e){Tu.call(this,e)}_p.prototype=Object.assign(Object.create(Bo.prototype),{constructor:_p,isInstancedBufferGeometry:!0,copy:function(e){return Bo.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Bo.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),Mp.prototype=Object.assign(Object.create(xo.prototype),{constructor:Mp,isInstancedBufferAttribute:!0,copy:function(e){return xo.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=xo.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ep.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Ep,load:function(e,t,n,i){var r=this,o=new Lu(r.manager);o.setPath(r.path),o.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(o){i?i(o):console.error(o),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=e.isInstancedBufferGeometry?new _p:new Bo,n=e.data.index;if(void 0!==n){var i=new Sp[n.type](n.array);t.setIndex(new xo(i,1))}var r=e.data.attributes;for(var o in r){var a=r[o],s=(i=new Sp[a.type](a.array),new(a.isInstancedBufferAttribute?Mp:xo)(i,a.itemSize,a.normalized));void 0!==a.name&&(s.name=a.name),t.setAttribute(o,s)}var l=e.data.morphAttributes;if(l)for(var o in l){for(var c=l[o],h=[],u=0,p=c.length;u<p;u++){a=c[u],s=new xo(i=new Sp[a.type](a.array),a.itemSize,a.normalized);void 0!==a.name&&(s.name=a.name),h.push(s)}t.morphAttributes[o]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new qi;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new Fr(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Sp={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ap(e){Tu.call(this,e)}Ap.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Ap,load:function(e,t,n,i){var r=this,o=""===this.path?wp(e):this.path;this.resourcePath=this.resourcePath||o;var a=new Lu(r.manager);a.setPath(this.path),a.load(e,(function(n){var o=null;try{o=JSON.parse(n)}catch(s){return void 0!==i&&i(s),void console.error("THREE:ObjectLoader: Can't parse "+e+".",s.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,i)},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,i,a);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new rp).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new Ep,r=0,o=e.length;r<o;r++){var a,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new Jh[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new Jh[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new Jh[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new Jh[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new Jh[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new Jh[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":a=new Jh[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new Jh[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new Jh[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new Jh[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":a=new Jh[s.type]((new tp[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":a=new Jh[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":a=new Jh[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,h=s.shapes.length;c<h;c++){var u=t[s.shapes[c]];l.push(u)}a=new Jh[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,h=s.shapes.length;c<h;c++){u=t[s.shapes[c]];l.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new tp[p.type]).fromJSON(p)),a=new Jh[s.type](l,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),!0===a.isBufferGeometry&&void 0!==s.userData&&(a.userData=s.userData),n[s.uuid]=a}return n},parseMaterials:function(e,t){var n={},i={};if(void 0!==e){var r=new xp;r.setTextures(t);for(var o=0,a=e.length;o<a;o++){var s=e[o];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var h=s.materials[c];void 0===n[h.uuid]&&(n[h.uuid]=r.parse(h)),l.push(n[h.uuid])}i[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=_u.parse(i);void 0!==i.uuid&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),o.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var o=new Ou(new Su(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a<s;a++){var l=e[a],c=l.url;if(Array.isArray(c)){i[l.uuid]=[];for(var h=0,u=c.length;h<u;h++){var p=c[h],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;i[l.uuid].push(r(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;i[l.uuid]=r(d)}}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,o=e.length;r<o;r++){var a,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(a=Array.isArray(t[s.image])?new Ga(t[s.image]):new ki(t[s.image])).needsUpdate=!0,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=n(s.mapping,Pp)),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=n(s.wrap[0],Lp),a.wrapT=n(s.wrap[1],Lp)),void 0!==s.format&&(a.format=s.format),void 0!==s.type&&(a.type=s.type),void 0!==s.encoding&&(a.encoding=s.encoding),void 0!==s.minFilter&&(a.minFilter=n(s.minFilter,Cp)),void 0!==s.magFilter&&(a.magFilter=n(s.magFilter,Cp)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),i[s.uuid]=a}return i},parseObject:function(e,t,n){var i;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function o(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],i=0,r=e.length;i<r;i++){var o=e[i];void 0===n[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),t.push(n[o])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new xr,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new co(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new Cl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new Ll(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new va(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new pp(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new mp(e.color,e.intensity);break;case"DirectionalLight":i=new fp(e.color,e.intensity);break;case"PointLight":i=new up(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new vp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new cp(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new ap(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new yp).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=new na(a=r(e.geometry),s=o(e.material));break;case"InstancedMesh":var a=r(e.geometry),s=o(e.material),l=e.count,c=e.instanceMatrix;(i=new dc(a,s,l)).instanceMatrix=new xo(new Float32Array(c.array),16);break;case"LOD":i=new ic;break;case"Line":i=new bc(r(e.geometry),o(e.material),e.mode);break;case"LineLoop":i=new Ec(r(e.geometry),o(e.material));break;case"LineSegments":i=new Mc(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":i=new Cc(r(e.geometry),o(e.material));break;case"Sprite":i=new Yl(o(e.material));break;case"Group":i=new El;break;default:i=new yr}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)i.add(this.parseObject(h[u],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=i.getObjectByProperty("uuid",f.object);void 0!==m&&i.addLevel(m,f.distance)}}return i}});var Tp,Pp={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:$n,CubeUVRefractionMapping:307},Lp={RepeatWrapping:ei,ClampToEdgeWrapping:ti,MirroredRepeatWrapping:ni},Cp={NearestFilter:ii,NearestMipmapNearestFilter:ri,NearestMipmapLinearFilter:oi,LinearFilter:ai,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:si};function Ip(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Tu.call(this,e),this.options=void 0}function Rp(){this.type="ShapePath",this.color=new co,this.subPaths=[],this.currentPath=null}function Op(e){this.type="Font",this.data=e}function Dp(e,t,n,i,r){var o=r.glyphs[e]||r.glyphs["?"];if(o){var a,s,l,c,h,u,p,d,f=new Rp;if(o.o)for(var m=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":a=m[v++]*t+n,s=m[v++]*t+i,f.moveTo(a,s);break;case"l":a=m[v++]*t+n,s=m[v++]*t+i,f.lineTo(a,s);break;case"q":l=m[v++]*t+n,c=m[v++]*t+i,h=m[v++]*t+n,u=m[v++]*t+i,f.quadraticCurveTo(h,u,l,c);break;case"b":l=m[v++]*t+n,c=m[v++]*t+i,h=m[v++]*t+n,u=m[v++]*t+i,p=m[v++]*t+n,d=m[v++]*t+i,f.bezierCurveTo(h,u,p,d,l,c)}}return{offsetX:o.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function Np(e){Tu.call(this,e)}Ip.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Ip,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,o=Eu.get(e);if(void 0!==o)return r.manager.itemStart(e),setTimeout((function(){t&&t(o),r.manager.itemEnd(e)}),0),o;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)})).then((function(n){Eu.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}),Object.assign(Rp.prototype,{moveTo:function(e,t){return this.currentPath=new ip,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],o=new rp;o.curves=r.curves,t.push(o)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,o=0;o<n;r=o++){var a=t[r],s=t[o],l=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(a=t[o],l=-l,s=t[r],c=-c),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var h=c*(e.x-a.x)-l*(e.y-a.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Ah.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);var a,s,l,c=[];if(1===o.length)return s=o[0],(l=new rp).curves=s.curves,c.push(l),c;var h=!r(o[0].getPoints());h=e?!h:h;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g<y;g++)a=r(u=(s=o[g]).getPoints()),(a=e?!a:a)?(!h&&f[v]&&v++,f[v]={s:new rp,p:u},f[v].s.curves=s.curves,h&&v++,m[v]=[]):m[v].push({h:s,p:u[0]});if(!f[0])return n(o);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E<M.length;E++){for(var S=M[E],A=!0,T=0;T<f.length;T++)i(S.p,f[T].p)&&(w!==T&&b.push({froms:w,tos:T,hole:E}),A?(A=!1,d[T].push(S)):x=!0);A&&d[w].push(S)}b.length>0&&(x||(m=d))}g=0;for(var P=f.length;g<P;g++){l=f[g].s,c.push(l);for(var L=0,C=(p=m[g]).length;L<C;L++)l.holes.push(p[L].h)}return c}}),Object.assign(Op.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,a=[],s=0,l=0,c=0;c<i.length;c++){var h=i[c];if("\n"===h)s=0,l-=o;else{var u=Dp(h,r,s,l,n);s+=u.offsetX,a.push(u.path)}}return a}(e,t,this.data),r=0,o=i.length;r<o;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),Np.prototype=Object.assign(Object.create(Tu.prototype),{constructor:Np,load:function(e,t,n,i){var r=this,o=new Lu(this.manager);o.setPath(this.path),o.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(o){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)}),n,i)},parse:function(e){return new Op(e)}});var Fp=function(){return void 0===Tp&&(Tp=new(window.AudioContext||window.webkitAudioContext)),Tp};function zp(e){Tu.call(this,e)}function Bp(e,t,n){yp.call(this,void 0,n);var i=(new co).set(e),r=(new co).set(t),o=new qi(i.r,i.g,i.b),a=new qi(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}function kp(e,t){yp.call(this,void 0,t);var n=(new co).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}zp.prototype=Object.assign(Object.create(Tu.prototype),{constructor:zp,load:function(e,t,n,i){var r=this,o=new Lu(r.manager);o.setResponseType("arraybuffer"),o.setPath(r.path),o.load(e,(function(n){try{var o=n.slice(0);Fp().decodeAudioData(o,(function(e){t(e)}))}catch(a){i?i(a):console.error(a),r.manager.itemError(e)}}),n,i)}}),Bp.prototype=Object.assign(Object.create(yp.prototype),{constructor:Bp,isHemisphereLightProbe:!0,copy:function(e){return yp.prototype.copy.call(this,e),this},toJSON:function(e){return yp.prototype.toJSON.call(this,e)}}),kp.prototype=Object.assign(Object.create(yp.prototype),{constructor:kp,isAmbientLightProbe:!0,copy:function(e){return yp.prototype.copy.call(this,e),this},toJSON:function(e){return yp.prototype.toJSON.call(this,e)}});var Hp=new er,Up=new er;function Gp(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new va,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new va,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),o=t.eyeSep/2,a=o*t.near/t.focus,s=t.near*Math.tan(Di.DEG2RAD*t.fov*.5)/t.zoom;Up.elements[12]=-o,Hp.elements[12]=o,n=-s*t.aspect+a,i=s*t.aspect+a,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),n=-s*t.aspect-a,i=s*t.aspect-a,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Up),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Hp)}}),Object.assign(Gp.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var jp=new qi,Vp=new ji,Wp=new qi,qp=new qi;function Xp(){yr.call(this),this.type="AudioListener",this.context=Fp(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Gp}function Yp(e){yr.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Xp.prototype=Object.assign(Object.create(yr.prototype),{constructor:Xp,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){yr.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(jp,Vp,Wp),qp.set(0,0,-1).applyQuaternion(Vp),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(jp.x,i),t.positionY.linearRampToValueAtTime(jp.y,i),t.positionZ.linearRampToValueAtTime(jp.z,i),t.forwardX.linearRampToValueAtTime(qp.x,i),t.forwardY.linearRampToValueAtTime(qp.y,i),t.forwardZ.linearRampToValueAtTime(qp.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(jp.x,jp.y,jp.z),t.setOrientation(qp.x,qp.y,qp.z,n.x,n.y,n.z)}}),Yp.prototype=Object.assign(Object.create(yr.prototype),{constructor:Yp,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){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:function(){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:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Qp=new qi,Zp=new ji,Jp=new qi,Kp=new qi;function $p(e){Yp.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function ed(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function td(e,t,n){var i,r,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}$p.prototype=Object.assign(Object.create(Yp.prototype),{constructor:$p,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(yr.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Qp,Zp,Jp),Kp.set(0,0,1).applyQuaternion(Zp);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Qp.x,n),t.positionY.linearRampToValueAtTime(Qp.y,n),t.positionZ.linearRampToValueAtTime(Qp.z,n),t.orientationX.linearRampToValueAtTime(Kp.x,n),t.orientationY.linearRampToValueAtTime(Kp.y,n),t.orientationZ.linearRampToValueAtTime(Kp.z,n)}else t.setPosition(Qp.x,Qp.y,Qp.z),t.setOrientation(Kp.x,Kp.y,Kp.z)}}}),Object.assign(ed.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(td.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)n[r+a]=n[a];o=t}else{var s=t/(o+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=o},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,i,r){if(i>=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i){ji.slerpFlat(e,t,e,t,e,n,i)},_slerpAdditive:function(e,t,n,i,r){var o=this._workIndex*r;ji.multiplyQuaternionsFlat(e,o,e,t,e,n),ji.slerpFlat(e,t,e,t,e,o,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}},_lerpAdditive:function(e,t,n,i,r){for(var o=0;o!==r;++o){var a=t+o;e[a]=e[a]+e[n+o]*i}}});var nd="\\[\\]\\.:\\/",id=new RegExp("[\\[\\]\\.:\\/]","g"),rd="[^\\[\\]\\.:\\/]",od="[^"+nd.replace("\\.","")+"]",ad=/((?:WC+[\/:])*)/.source.replace("WC",rd),sd=/(WCOD+)?/.source.replace("WCOD",od),ld=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rd),cd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rd),hd=new RegExp("^"+ad+sd+ld+cd+"$"),ud=["material","materials","bones"];function pd(e,t,n){var i=n||dd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function dd(e,t,n){this.path=t,this.parsedPath=n||dd.parseTrackName(t),this.node=dd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function fd(e,t,n,i){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=i||t.blendMode;for(var r=t.tracks,o=r.length,a=new Array(o),s={endingStart:wi,endingEnd:wi},l=0;l!==o;++l){var c=r[l].createInterpolant(null);a[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),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}function md(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function vd(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function gd(e,t,n){Il.call(this,e,t),this.meshPerAttribute=n||1}function yd(e,t,n,i){this.ray=new Vr(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new rr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function xd(e,t){return e.distance-t.distance}function bd(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,o=0,a=r.length;o<a;o++)bd(r[o],t,n,!0)}Object.assign(pd.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(dd,{Composite:pd,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new dd.Composite(e,t,n):new dd(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(id,"")},parseTrackName:function(e){var t=hd.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==ud.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n<e.length;n++){var r=e[n];if(r.name===t||r.uuid===t)return r;var o=i(r.children);if(o)return o}return null},r=i(e.children);if(r)return r}return null}}),Object.assign(dd.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=dd.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var o=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var a=0;a<e.length;a++)if(e[a].name===o){o=a;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}var s=e[i];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(dd.prototype,{_getValue_unbound:dd.prototype.getValue,_setValue_unbound:dd.prototype.setValue}),Object.assign(function(){this.uuid=Di.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,l=void 0,c=0,h=arguments.length;c!==h;++c){var u=arguments[c],p=u.uuid,d=i[p];if(void 0===d){d=t++,i[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)a[f].push(new dd(u,r[f],o[f]))}else if(d<n){l=e[d];var v=--n,g=e[v];i[g.uuid]=d,e[d]=g,i[p]=v,e[v]=u;for(f=0,m=s;f!==m;++f){var y=a[f],x=y[v],b=y[d];y[d]=x,void 0===b&&(b=new dd(u,r[f],o[f])),y[v]=b}}else e[d]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],l=s.uuid,c=n[l];if(void 0!==c&&c>=t){var h=t++,u=e[h];n[u.uuid]=c,e[c]=u,n[l]=h,e[h]=s;for(var p=0,d=r;p!==d;++p){var f=i[p],m=f[h],v=f[c];f[c]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var l=arguments[a],c=l.uuid,h=i[c];if(void 0!==h)if(delete i[c],h<n){var u=--n,p=e[u],d=e[y=--t];i[p.uuid]=h,e[h]=p,i[d.uuid]=u,e[u]=d,e.pop();for(var f=0,m=o;f!==m;++f){var v=(x=r[f])[u],g=x[y];x[h]=v,x[u]=g,x.pop()}}else{var y;i[(d=e[y=--t]).uuid]=h,e[h]=d,e.pop();for(f=0,m=o;f!==m;++f){var x;(x=r[f])[h]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(var u=c,p=s.length;u!==p;++u){var d=s[u];h[u]=new dd(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}),Object.assign(fd.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/a,l[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var o=(e-r)*n;if(o<0||0===n)return;this._startTime=null,t=n*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;if(2501===this.blendMode)for(var h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(s);else for(h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,s)}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,o=2202===i;if(0===e)return-1===r?t:o&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=_i,i.endingEnd=_i):(i.endingStart=e?this.zeroSlopeAtStart?_i:wi:Mi,i.endingEnd=t?this.zeroSlopeAtEnd?_i:wi:Mi)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}}),md.prototype=Object.assign(Object.create(Ci.prototype),{constructor:md,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var h=0;h!==r;++h){var u=i[h],p=u.name,d=c[p];if(void 0!==d)o[h]=d;else{if(void 0!==(d=o[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new td(dd.create(n,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[h]=d}a[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,o=r[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete a.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],o=this._bindings;void 0===r&&(r={},i[t]=r),r[n]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete a[r],0===Object.keys(a).length&&delete o[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new pu(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var i=t||this._root,r=i.uuid,o="string"==typeof e?_u.findByName(i,e):e,a=null!==o?o.uuid:e,s=this._actionsByClip[a],l=null;if(void 0===n&&(n=null!==o?o.blendMode:Ei),void 0!==s){var c=s.actionByRoot[r];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;var h=new fd(this,o,t,n);return this._bindAction(h,l),this._addInactiveAction(h,a,r),h},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?_u.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a){t[a]._update(i,e,r,o)}var s=this._bindings,l=this._nActiveBindings;for(a=0;a!==l;++a)s[a].apply(o);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var l=o[a];this._deactivateAction(l);var c=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=c,t[c]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var o=this._bindingsByRootAndName[t];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),vd.prototype.clone=function(){return new vd(void 0===this.value.clone?this.value:this.value.clone())},gd.prototype=Object.assign(Object.create(Il.prototype),{constructor:gd,isInstancedInterleavedBuffer:!0,copy:function(e){return Il.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(yd.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return bd(e,this,i,t),i.sort(xd),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,o=e.length;r<o;r++)bd(e[r],this,i,t);return i.sort(xd),i}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Di.clamp(t/this.radius,-1,1))),this}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var wd=new Ni;function _d(e,t){this.min=void 0!==e?e:new Ni(1/0,1/0),this.max=void 0!==t?t:new Ni(-1/0,-1/0)}Object.assign(_d.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=wd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new Ni),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new Ni),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Ni),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Ni),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return wd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Md=new qi,Ed=new qi;function Sd(e,t){this.start=void 0!==e?e:new qi,this.end=void 0!==t?t:new qi}function Ad(e){yr.call(this),this.material=e,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}Object.assign(Sd.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new qi),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new qi),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new qi),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Md.subVectors(e,this.start),Ed.subVectors(this.end,this.start);var n=Ed.dot(Ed),i=Ed.dot(Md)/n;return t&&(i=Di.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new qi),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Ad.prototype=Object.create(yr.prototype),Ad.prototype.constructor=Ad,Ad.prototype.isImmediateRenderObject=!0;var Td=new qi;function Pd(e,t){yr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Bo,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,o=1;r<32;r++,o++){var a=r/32*Math.PI*2,s=o/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new To(i,3));var l=new fc({fog:!1,toneMapped:!1});this.cone=new Mc(n,l),this.add(this.cone),this.update()}Pd.prototype=Object.create(yr.prototype),Pd.prototype.constructor=Pd,Pd.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Pd.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Td.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Td),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Ld=new qi,Cd=new er,Id=new er;function Rd(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,Rd(e.children[n]));return t}function Od(e){for(var t=Rd(e),n=new Bo,i=[],r=[],o=new co(0,0,1),a=new co(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new To(i,3)),n.setAttribute("color",new To(r,3));var c=new fc({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Mc.call(this,n,c),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Dd(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new Fh(t,4,2),r=new go({wireframe:!0,fog:!1,toneMapped:!1});na.call(this,i,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Od.prototype=Object.create(Mc.prototype),Od.prototype.constructor=Od,Od.prototype.isSkeletonHelper=!0,Od.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");Id.getInverse(this.root.matrixWorld);for(var r=0,o=0;r<t.length;r++){var a=t[r];a.parent&&a.parent.isBone&&(Cd.multiplyMatrices(Id,a.matrixWorld),Ld.setFromMatrixPosition(Cd),i.setXYZ(o,Ld.x,Ld.y,Ld.z),Cd.multiplyMatrices(Id,a.parent.matrixWorld),Ld.setFromMatrixPosition(Cd),i.setXYZ(o+1,Ld.x,Ld.y,Ld.z),o+=2)}n.getAttribute("position").needsUpdate=!0,yr.prototype.updateMatrixWorld.call(this,e)},Dd.prototype=Object.create(na.prototype),Dd.prototype.constructor=Dd,Dd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Dd.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Nd=new qi,Fd=new co,zd=new co;function Bd(e,t,n){yr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new Vc(t);i.rotateY(.5*Math.PI),this.material=new go({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=i.getAttribute("position"),o=new Float32Array(3*r.count);i.setAttribute("color",new xo(o,3)),this.add(new na(i,this.material)),this.update()}function kd(e,t,n,i){e=e||10,t=t||10,n=new co(void 0!==n?n:4473924),i=new co(void 0!==i?i:8947848);for(var r=t/2,o=e/t,a=e/2,s=[],l=[],c=0,h=0,u=-a;c<=t;c++,u+=o){s.push(-a,0,u,a,0,u),s.push(u,0,-a,u,0,a);var p=c===r?n:i;p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3}var d=new Bo;d.setAttribute("position",new To(s,3)),d.setAttribute("color",new To(l,3));var f=new fc({vertexColors:!0,toneMapped:!1});Mc.call(this,d,f),this.type="GridHelper"}function Hd(e,t,n,i,r,o){e=e||10,t=t||16,n=n||8,i=i||64,r=new co(void 0!==r?r:4473924),o=new co(void 0!==o?o:8947848);var a,s,l,c,h,u,p,d=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),a=Math.sin(l)*e,s=Math.cos(l)*e,d.push(0,0,0),d.push(a,0,s),p=1&c?r:o,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(c=0;c<=n;c++)for(p=1&c?r:o,u=e-e/n*c,h=0;h<i;h++)l=h/i*(2*Math.PI),a=Math.sin(l)*u,s=Math.cos(l)*u,d.push(a,0,s),f.push(p.r,p.g,p.b),l=(h+1)/i*(2*Math.PI),a=Math.sin(l)*u,s=Math.cos(l)*u,d.push(a,0,s),f.push(p.r,p.g,p.b);var m=new Bo;m.setAttribute("position",new To(d,3)),m.setAttribute("color",new To(f,3));var v=new fc({vertexColors:!0,toneMapped:!1});Mc.call(this,m,v),this.type="PolarGridHelper"}Bd.prototype=Object.create(yr.prototype),Bd.prototype.constructor=Bd,Bd.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Bd.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Fd.copy(this.light.color),zd.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?Fd:zd;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(Nd.setFromMatrixPosition(this.light.matrixWorld).negate())},kd.prototype=Object.assign(Object.create(Mc.prototype),{constructor:kd,copy:function(e){return Mc.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Hd.prototype=Object.create(Mc.prototype),Hd.prototype.constructor=Hd;var Ud=new qi,Gd=new qi,jd=new qi;function Vd(e,t,n){yr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new Bo;i.setAttribute("position",new To([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new fc({fog:!1,toneMapped:!1});this.lightPlane=new bc(i,r),this.add(this.lightPlane),(i=new Bo).setAttribute("position",new To([0,0,0,0,0,1],3)),this.targetLine=new bc(i,r),this.add(this.targetLine),this.update()}Vd.prototype=Object.create(yr.prototype),Vd.prototype.constructor=Vd,Vd.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Vd.prototype.update=function(){Ud.setFromMatrixPosition(this.light.matrixWorld),Gd.setFromMatrixPosition(this.light.target.matrixWorld),jd.subVectors(Gd,Ud),this.lightPlane.lookAt(Gd),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Gd),this.targetLine.scale.z=jd.length()};var Wd=new qi,qd=new ma;function Xd(e){var t=new Bo,n=new fc({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={},a=new co(16755200),s=new co(16711680),l=new co(43775),c=new co(16777215),h=new co(3355443);function u(e,t,n){p(e,n),p(t,n)}function p(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(i.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new To(i,3)),t.setAttribute("color",new To(r,3)),Mc.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}function Yd(e,t,n,i,r,o,a){Wd.set(r,o,a).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),c=0,h=s.length;c<h;c++)l.setXYZ(s[c],Wd.x,Wd.y,Wd.z)}Xd.prototype=Object.create(Mc.prototype),Xd.prototype.constructor=Xd,Xd.prototype.update=function(){var e=this.geometry,t=this.pointMap;qd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Yd("c",t,e,qd,0,0,-1),Yd("t",t,e,qd,0,0,1),Yd("n1",t,e,qd,-1,-1,-1),Yd("n2",t,e,qd,1,-1,-1),Yd("n3",t,e,qd,-1,1,-1),Yd("n4",t,e,qd,1,1,-1),Yd("f1",t,e,qd,-1,-1,1),Yd("f2",t,e,qd,1,-1,1),Yd("f3",t,e,qd,-1,1,1),Yd("f4",t,e,qd,1,1,1),Yd("u1",t,e,qd,.7,1.1,-1),Yd("u2",t,e,qd,-.7,1.1,-1),Yd("u3",t,e,qd,0,2,-1),Yd("cf1",t,e,qd,-1,0,1),Yd("cf2",t,e,qd,1,0,1),Yd("cf3",t,e,qd,0,-1,1),Yd("cf4",t,e,qd,0,1,1),Yd("cn1",t,e,qd,-1,0,-1),Yd("cn2",t,e,qd,1,0,-1),Yd("cn3",t,e,qd,0,-1,-1),Yd("cn4",t,e,qd,0,1,-1),e.getAttribute("position").needsUpdate=!0};var Qd=new Or;function Zd(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Bo;r.setIndex(new xo(n,1)),r.setAttribute("position",new xo(i,3)),Mc.call(this,r,new fc({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function Jd(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Bo;i.setIndex(new xo(n,1)),i.setAttribute("position",new To([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Mc.call(this,i,new fc({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function Kd(e,t,n){this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new Bo;r.setAttribute("position",new To([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),bc.call(this,r,new fc({color:i,toneMapped:!1})),this.type="PlaneHelper";var o=new Bo;o.setAttribute("position",new To([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new na(o,new go({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}Zd.prototype=Object.create(Mc.prototype),Zd.prototype.constructor=Zd,Zd.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Qd.setFromObject(this.object),!Qd.isEmpty()){var t=Qd.min,n=Qd.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Zd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Zd.prototype.copy=function(e){return Mc.prototype.copy.call(this,e),this.object=e.object,this},Zd.prototype.clone=function(){return(new this.constructor).copy(this)},Jd.prototype=Object.create(Mc.prototype),Jd.prototype.constructor=Jd,Jd.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),yr.prototype.updateMatrixWorld.call(this,e))},Kd.prototype=Object.create(bc.prototype),Kd.prototype.constructor=Kd,Kd.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),yr.prototype.updateMatrixWorld.call(this,e)};var $d,ef,tf=new qi;function nf(e,t,n,i,r,o){yr.call(this),this.type="ArrowHelper",void 0===e&&(e=new qi(0,0,1)),void 0===t&&(t=new qi(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),void 0===$d&&(($d=new Bo).setAttribute("position",new To([0,0,0,0,1,0],3)),(ef=new qh(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new bc($d,new fc({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new na(ef,new go({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}function rf(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Bo;n.setAttribute("position",new To(t,3)),n.setAttribute("color",new To([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new fc({vertexColors:!0,toneMapped:!1});Mc.call(this,n,i),this.type="AxesHelper"}nf.prototype=Object.create(yr.prototype),nf.prototype.constructor=nf,nf.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{tf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(tf,t)}},nf.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},nf.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},nf.prototype.copy=function(e){return yr.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},nf.prototype.clone=function(){return(new this.constructor).copy(this)},rf.prototype=Object.create(Mc.prototype),rf.prototype.constructor=rf;var of=[.125,.215,.35,.446,.526,.582],af=5+of.length;new pp,function(){for(var e=[],t=[],n=[],i=8,r=0;r<af;r++){var o=Math.pow(2,i);t.push(o);var a=1/o;r>4?a=of[r-8+4-1]:0==r&&(a=0),n.push(a);for(var s=1/(o-1),l=-s/2,c=1+s/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];u.set(g,18*f),p.set(h,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new Bo;x.setAttribute("position",new xo(u,3)),x.setAttribute("uv",new xo(p,2)),x.setAttribute("faceIndex",new xo(d,1)),e.push(x),i>4&&i--}}();var sf=(1+Math.sqrt(5))/2,lf=1/sf;function cf(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Vu.call(this,e),this.type="catmullrom"}new qi(1,1,1),new qi(-1,1,1),new qi(1,1,-1),new qi(-1,1,-1),new qi(0,sf,lf),new qi(0,sf,-lf),new qi(lf,0,sf),new qi(-lf,0,sf),new qi(sf,lf,0),new qi(-sf,lf,0),Fu.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Fu.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(np.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new ca,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new qi(r.x,r.y,r.z||0))}return t}}),Object.assign(ip.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),cf.prototype=Object.create(Vu.prototype),Object.assign(cf.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),kd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Od.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Tu.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),wp(e)}}),Tu.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.")}},Object.assign(Ap.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(_d.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Or.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Fr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Ma.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Sd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Di,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Di.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Di.ceilPowerOfTwo(e)}}),Object.assign(Fi.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(er.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new qi).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,o)}}),Yr.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},ji.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Vr.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(oo.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(oo,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),oo.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),oo.getNormal(e,t,n,i)}}),Object.assign(rp.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Lh(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Uh(this,e)}}),Object.assign(Ni.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(qi.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Hi.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ca.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(yr.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(yr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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.")}}}),Object.assign(na.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(na.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.")}}}),Object.defineProperties(ic.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(sc.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),rc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Fu.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),va.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(op.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(xo.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."),this.usage===Li},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Li)}}}),Object.assign(xo.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Li:Pi),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Bo.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new xo(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Bo.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}}}),Object.defineProperties(_p.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(yd.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(Il.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Li},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Il.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Li:Pi),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Ch.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(vd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(vo.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 co}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(nu.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(fa.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Pl.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Pl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},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(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Ai:Si}}}),Object.defineProperties(xl.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(Ui.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Yp.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new zp).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),ed.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ya.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},zi.crossOrigin=void 0,zi.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Nu;r.setCrossOrigin(this.crossOrigin);var o=r.load(e,n,void 0,i);return t&&(o.mapping=t),o},zi.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Du;r.setCrossOrigin(this.crossOrigin);var o=r.load(e,n,void 0,i);return t&&(o.mapping=t),o},zi.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},zi.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:"117"}}))
2
+ /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */;var hf={},uf=void 0,pf=hf;function df(e,t){var n,i=e.split("."),r=pf;!(i[0]in r)&&r.execScript&&r.execScript("var "+i[0]);for(;i.length&&(n=i.shift());)i.length||t===uf?r=r[n]?r[n]:r[n]={}:r[n]=t}var ff="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function mf(e){var t,n,i,r,o,a,s,l,c,h,u=e.length,p=0,d=Number.POSITIVE_INFINITY;for(l=0;l<u;++l)e[l]>p&&(p=e[l]),e[l]<d&&(d=e[l]);for(t=1<<p,n=new(ff?Uint32Array:Array)(t),i=1,r=0,o=2;i<=p;){for(l=0;l<u;++l)if(e[l]===i){for(a=0,s=r,c=0;c<i;++c)a=a<<1|1&s,s>>=1;for(h=i<<16|l,c=a;c<t;c+=o)n[c]=h;++r}++i,r<<=1,o<<=1}return[n,p,d]}function vf(e,t){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=ff?new Uint8Array(e):e,this.m=!1,this.i=yf,this.r=!1,!t&&(t={})||(t.index&&(this.a=t.index),t.bufferSize&&(this.h=t.bufferSize),t.bufferType&&(this.i=t.bufferType),t.resize&&(this.r=t.resize)),this.i){case gf:this.b=32768,this.c=new(ff?Uint8Array:Array)(32768+this.h+258);break;case yf:this.b=0,this.c=new(ff?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var gf=0,yf=1,xf={t:gf,s:yf};vf.prototype.k=function(){for(;!this.m;){var e=Bf(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var t=this.input,n=this.a,i=this.c,r=this.b,o=t.length,a=uf,s=i.length,l=uf;if(this.d=this.f=0,n+1>=o)throw Error("invalid uncompressed block header: LEN");if(a=t[n++]|t[n++]<<8,n+1>=o)throw Error("invalid uncompressed block header: NLEN");if(a===~(t[n++]|t[n++]<<8))throw Error("invalid uncompressed block header: length verify");if(n+a>t.length)throw Error("input buffer is broken");switch(this.i){case gf:for(;r+a>i.length;){if(a-=l=s-r,ff)i.set(t.subarray(n,n+l),r),r+=l,n+=l;else for(;l--;)i[r++]=t[n++];this.b=r,i=this.e(),r=this.b}break;case yf:for(;r+a>i.length;)i=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(ff)i.set(t.subarray(n,n+a),r),r+=a,n+=a;else for(;a--;)i[r++]=t[n++];this.a=n,this.b=r,this.c=i;break;case 1:this.j(Nf,zf);break;case 2:var c,h,u,p,d=Bf(this,5)+257,f=Bf(this,5)+1,m=Bf(this,4)+4,v=new(ff?Uint8Array:Array)(Mf.length),g=uf,y=uf,x=uf,b=uf,w=uf;for(w=0;w<m;++w)v[Mf[w]]=Bf(this,3);if(!ff)for(w=m,m=v.length;w<m;++w)v[Mf[w]]=0;for(c=mf(v),g=new(ff?Uint8Array:Array)(d+f),w=0,p=d+f;w<p;)switch(y=kf(this,c),y){case 16:for(b=3+Bf(this,2);b--;)g[w++]=x;break;case 17:for(b=3+Bf(this,3);b--;)g[w++]=0;x=0;break;case 18:for(b=11+Bf(this,7);b--;)g[w++]=0;x=0;break;default:x=g[w++]=y}h=mf(ff?g.subarray(0,d):g.slice(0,d)),u=mf(ff?g.subarray(d):g.slice(d)),this.j(h,u);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var bf,wf,_f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Mf=ff?new Uint16Array(_f):_f,Ef=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],Sf=ff?new Uint16Array(Ef):Ef,Af=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Tf=ff?new Uint8Array(Af):Af,Pf=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Lf=ff?new Uint16Array(Pf):Pf,Cf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],If=ff?new Uint8Array(Cf):Cf,Rf=new(ff?Uint8Array:Array)(288);for(bf=0,wf=Rf.length;bf<wf;++bf)Rf[bf]=143>=bf?8:255>=bf?9:279>=bf?7:8;var Of,Df,Nf=mf(Rf),Ff=new(ff?Uint8Array:Array)(30);for(Of=0,Df=Ff.length;Of<Df;++Of)Ff[Of]=5;var zf=mf(Ff);function Bf(e,t){for(var n,i=e.f,r=e.d,o=e.input,a=e.a,s=o.length;r<t;){if(a>=s)throw Error("input buffer is broken");i|=o[a++]<<r,r+=8}return n=i&(1<<t)-1,e.f=i>>>t,e.d=r-t,e.a=a,n}function kf(e,t){for(var n,i,r=e.f,o=e.d,a=e.input,s=e.a,l=a.length,c=t[0],h=t[1];o<h&&!(s>=l);)r|=a[s++]<<o,o+=8;if((i=(n=c[r&(1<<h)-1])>>>16)>o)throw Error("invalid code length: "+i);return e.f=r>>i,e.d=o-i,e.a=s,65535&n}function Hf(e,t){var n,i;if(this.input=e,this.a=0,!t&&(t={})||(t.index&&(this.a=t.index),t.verify&&(this.A=t.verify)),n=e[this.a++],i=e[this.a++],(15&n)!==Uf)throw Error("unsupported compression method");if(this.method=Uf,((n<<8)+i)%31!=0)throw Error("invalid fcheck flag:"+((n<<8)+i)%31);if(32&i)throw Error("fdict flag is not supported");this.q=new vf(e,{index:this.a,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}vf.prototype.j=function(e,t){var n=this.c,i=this.b;this.o=e;for(var r,o,a,s,l=n.length-258;256!==(r=kf(this,e));)if(256>r)i>=l&&(this.b=i,n=this.e(),i=this.b),n[i++]=r;else for(s=Sf[o=r-257],0<Tf[o]&&(s+=Bf(this,Tf[o])),r=kf(this,t),a=Lf[r],0<If[r]&&(a+=Bf(this,If[r])),i>=l&&(this.b=i,n=this.e(),i=this.b);s--;)n[i]=n[i++-a];for(;8<=this.d;)this.d-=8,this.a--;this.b=i},vf.prototype.w=function(e,t){var n=this.c,i=this.b;this.o=e;for(var r,o,a,s,l=n.length;256!==(r=kf(this,e));)if(256>r)i>=l&&(l=(n=this.e()).length),n[i++]=r;else for(s=Sf[o=r-257],0<Tf[o]&&(s+=Bf(this,Tf[o])),r=kf(this,t),a=Lf[r],0<If[r]&&(a+=Bf(this,If[r])),i+s>l&&(l=(n=this.e()).length);s--;)n[i]=n[i++-a];for(;8<=this.d;)this.d-=8,this.a--;this.b=i},vf.prototype.e=function(){var e,t,n=new(ff?Uint8Array:Array)(this.b-32768),i=this.b-32768,r=this.c;if(ff)n.set(r.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=r[e+32768];if(this.g.push(n),this.l+=n.length,ff)r.set(r.subarray(i,i+32768));else for(e=0;32768>e;++e)r[e]=r[i+e];return this.b=32768,r},vf.prototype.z=function(e){var t,n,i,r=this.input.length/this.a+1|0,o=this.input,a=this.c;return e&&("number"==typeof e.p&&(r=e.p),"number"==typeof e.u&&(r+=e.u)),2>r?n=(i=(o.length-this.a)/this.o[2]/2*258|0)<a.length?a.length+i:a.length<<1:n=a.length*r,ff?(t=new Uint8Array(n)).set(a):t=a,this.c=t},vf.prototype.n=function(){var e,t,n,i,r,o=0,a=this.c,s=this.g,l=new(ff?Uint8Array:Array)(this.l+(this.b-32768));if(0===s.length)return ff?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(t=0,n=s.length;t<n;++t)for(i=0,r=(e=s[t]).length;i<r;++i)l[o++]=e[i];for(t=32768,n=this.b;t<n;++t)l[o++]=a[t];return this.g=[],this.buffer=l},vf.prototype.v=function(){var e,t=this.b;return ff?this.r?(e=new Uint8Array(t)).set(this.c.subarray(0,t)):e=this.c.subarray(0,t):(this.c.length>t&&(this.c.length=t),e=this.c),this.buffer=e},Hf.prototype.k=function(){var e,t,n=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){t=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var i=e;if("string"==typeof i){var r,o,a=i.split("");for(r=0,o=a.length;r<o;r++)a[r]=(255&a[r].charCodeAt(0))>>>0;i=a}for(var s,l=1,c=0,h=i.length,u=0;0<h;){h-=s=1024<h?1024:h;do{c+=l+=i[u++]}while(--s);l%=65521,c%=65521}if(t!==(c<<16|l)>>>0)throw Error("invalid adler-32 checksum")}return e};var Uf=8;df("Zlib.Inflate",Hf),df("Zlib.Inflate.prototype.decompress",Hf.prototype.k);var Gf,jf,Vf,Wf,qf={ADAPTIVE:xf.s,BLOCK:xf.t};if(Object.keys)Gf=Object.keys(qf);else for(jf in Gf=[],Vf=0,qf)Gf[Vf++]=jf;for(Vf=0,Wf=Gf.length;Vf<Wf;++Vf)df("Zlib.Inflate.BufferType."+(jf=Gf[Vf]),qf[jf]);var Xf=hf.Zlib,Yf={findSpan:function(e,t,n){var i=n.length-e-1;if(t>=n[i])return i-1;if(t<=n[e])return e;for(var r=e,o=i,a=Math.floor((r+o)/2);t<n[a]||t>=n[a+1];)t<n[a]?o=a:r=a,a=Math.floor((r+o)/2);return a},calcBasisFunctions:function(e,t,n,i){var r=[],o=[],a=[];r[0]=1;for(var s=1;s<=n;++s){o[s]=t-i[e+1-s],a[s]=i[e+s]-t;for(var l=0,c=0;c<s;++c){var h=a[c+1],u=o[s-c],p=r[c]/(h+u);r[c]=l+h*p,l=u*p}r[s]=l}return r},calcBSplinePoint:function(e,t,n,i){for(var r=this.findSpan(e,i,t),o=this.calcBasisFunctions(r,i,e,t),a=new Hi(0,0,0,0),s=0;s<=e;++s){var l=n[r-e+s],c=o[s],h=l.w*c;a.x+=l.x*h,a.y+=l.y*h,a.z+=l.z*h,a.w+=l.w*c}return a},calcBasisFunctionDerivatives:function(e,t,n,i,r){for(var o=[],a=0;a<=n;++a)o[a]=0;var s=[];for(a=0;a<=i;++a)s[a]=o.slice(0);var l=[];for(a=0;a<=n;++a)l[a]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),h=o.slice(0),u=1;u<=n;++u){c[u]=t-r[e+1-u],h[u]=r[e+u]-t;for(var p=0,d=0;d<u;++d){var f=h[d+1],m=c[u-d];l[u][d]=f+m;var v=l[d][u-1]/l[u][d];l[d][u]=p+f*v,p=m*v}l[u][u]=p}for(u=0;u<=n;++u)s[0][u]=l[u][n];for(d=0;d<=n;++d){var g=0,y=1,x=[];for(a=0;a<=n;++a)x[a]=o.slice(0);x[0][0]=1;for(var b=1;b<=i;++b){var w=0,_=d-b,M=n-b;d>=b&&(x[y][0]=x[g][0]/l[M+1][_],w=x[y][0]*l[_][M]);var E=d-1<=M?b-1:n-d;for(u=_>=-1?1:-_;u<=E;++u)x[y][u]=(x[g][u]-x[g][u-1])/l[M+1][_+u],w+=x[y][u]*l[_+u][M];d<=M&&(x[y][b]=-x[g][b-1]/l[M+1][d],w+=x[y][b]*l[d][M]),s[b][d]=w;u=g;g=y,y=u}}for(d=n,b=1;b<=i;++b){for(u=0;u<=n;++u)s[b][u]*=d;d*=n-b}return s},calcBSplineDerivatives:function(e,t,n,i,r){for(var o=r<e?r:e,a=[],s=this.findSpan(e,i,t),l=this.calcBasisFunctionDerivatives(s,i,e,o,t),c=[],h=0;h<n.length;++h){var u=(d=n[h].clone()).w;d.x*=u,d.y*=u,d.z*=u,c[h]=d}for(var p=0;p<=o;++p){for(var d=c[s-e].clone().multiplyScalar(l[p][0]),f=1;f<=e;++f)d.add(c[s-e+f].clone().multiplyScalar(l[p][f]));a[p]=d}for(p=o+1;p<=r+1;++p)a[p]=new Hi(0,0,0);return a},calcKoverI:function(e,t){for(var n=1,i=2;i<=e;++i)n*=i;var r=1;for(i=2;i<=t;++i)r*=i;for(i=2;i<=e-t;++i)r*=i;return n/r},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],i=[],r=0;r<t;++r){var o=e[r];n[r]=new qi(o.x,o.y,o.z),i[r]=o.w}for(var a=[],s=0;s<t;++s){var l=n[s].clone();for(r=1;r<=s;++r)l.sub(a[s-r].clone().multiplyScalar(this.calcKoverI(s,r)*i[r]));a[s]=l.divideScalar(i[0])}return a},calcNURBSDerivatives:function(e,t,n,i,r){var o=this.calcBSplineDerivatives(e,t,n,i,r);return this.calcRationalCurveDerivatives(o)},calcSurfacePoint:function(e,t,n,i,r,o,a,s){for(var l=this.findSpan(e,o,n),c=this.findSpan(t,a,i),h=this.calcBasisFunctions(l,o,e,n),u=this.calcBasisFunctions(c,a,t,i),p=[],d=0;d<=t;++d){p[d]=new Hi(0,0,0,0);for(var f=0;f<=e;++f){var m=r[l-e+f][c-t+d].clone(),v=m.w;m.x*=v,m.y*=v,m.z*=v,p[d].add(m.multiplyScalar(h[f]))}}var g=new Hi(0,0,0,0);for(d=0;d<=t;++d)g.add(p[d].multiplyScalar(u[d]));g.divideScalar(g.w),s.set(g.x,g.y,g.z)}},Qf=function(e,t,n,i,r){Fu.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=r||this.knots.length-1;for(var o=0;o<n.length;++o){var a=n[o];this.controlPoints[o]=new Hi(a.x,a.y,a.z,a.w)}};(Qf.prototype=Object.create(Fu.prototype)).constructor=Qf,Qf.prototype.getPoint=function(e,t){var n=t||new qi,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=Yf.calcBSplinePoint(this.degree,this.knots,this.controlPoints,i);return 1!=r.w&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)},Qf.prototype.getTangent=function(e,t){var n=t||new qi,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=Yf.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,i,1);return n.copy(r[1]).normalize(),n};var Zf=function(){var e,t,n;function i(e){Tu.call(this,e)}function r(e,t){this.textureLoader=e,this.manager=t}function o(){}function a(){}function s(){}function l(){}function c(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function h(){}function u(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function p(e){return e/46186158e3}i.prototype=Object.assign(Object.create(Tu.prototype),{constructor:i,load:function(e,t,n,i){var r=this,o=""===r.path?wp(e):r.path,a=new Lu(this.manager);a.setPath(r.path),a.setResponseType("arraybuffer"),a.load(e,(function(n){try{t(r.parse(n,o))}catch(a){i?i(a):console.error(a),r.manager.itemError(e)}}),n,i)},parse:function(t,n){if(a="Kaydara FBX Binary \0",(o=t).byteLength>=a.length&&a===b(o,0,a.length))e=(new l).parse(t);else{var i=b(t);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function i(t){var i=e[t-1];return e=e.slice(n+t),n++,i}for(var r=0;r<t.length;++r){if(i(1)===t[r])return!1}return!0}(i))throw new Error("THREE.FBXLoader: Unknown format.");if(u(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+u(i));e=(new s).parse(i)}var o,a;return new r(new Nu(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),r.prototype={constructor:r,parse:function(){t=this.parseConnections();var e=this.parseImages(),i=this.parseTextures(e),r=this.parseMaterials(i),a=this.parseDeformers(),s=(new o).parse(a);return this.parseScene(a,s,r),n},parseConnections:function(){var t=new Map;"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],i=e[1],r=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:i,relationship:r};t.get(n).parents.push(o),t.has(i)||t.set(i,{parents:[],children:[]});var a={ID:n,relationship:r};t.get(i).children.push(a)}));return t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var i=e.Objects.Video;for(var r in i){var o=i[r];if(t[c=parseInt(r)]=o.RelativeFilename||o.Filename,"Content"in o){var a=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,s="string"==typeof o.Content&&""!==o.Content;if(a||s){var l=this.parseImage(i[r]);n[o.RelativeFilename||o.Filename]=l}}}}for(var c in t){var h=t[c];void 0!==n[h]?t[c]=n[h]:t[c]=t[c].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();switch(r){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",i),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+r+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var i=e.Objects.Texture;for(var r in i){var o=this.parseTexture(i[r],t);n.set(parseInt(r),o)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var i=e.WrapModeU,r=e.WrapModeV,o=void 0!==i?i.value:0,a=void 0!==r?r.value:0;if(n.wrapS=0===o?ei:ti,n.wrapT=0===a?ei:ti,"Scaling"in e){var s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n},loadTexture:function(e,n){var i,r,o=this.textureLoader.path,a=t.get(e.id).children;void 0!==a&&a.length>0&&void 0!==n[a[0].ID]&&(0!==(i=n[a[0].ID]).indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));var s=e.FileName.slice(-3).toLowerCase();if("tga"===s){var l=this.manager.getHandler(".tga");null===l?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),r=new ki):r=l.load(i)}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),r=new ki):r=this.textureLoader.load(i);return this.textureLoader.setPath(o),r},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var i=e.Objects.Material;for(var r in i){var o=this.parseMaterial(i[r],t);null!==o&&n.set(parseInt(r),o)}}return n},parseMaterial:function(e,n){var i=e.id,r=e.attrName,o=e.ShadingModel;if("object"==typeof o&&(o=o.value),!t.has(i))return null;var a,s=this.parseParameters(e,n,i);switch(o.toLowerCase()){case"phong":a=new nu;break;case"lambert":a=new ou;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),a=new nu}return a.setValues(s),a.name=r,a},parseParameters:function(e,n,i){var r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new co).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(r.color=(new co).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new co).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(r.emissive=(new co).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new co).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new co).fromArray(e.SpecularColor.value));var o=this;return t.get(i).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":r.bumpMap=o.getTexture(n,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(n,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(n,e.ID),r.map.encoding=Ai;break;case"DisplacementColor":r.displacementMap=o.getTexture(n,e.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(n,e.ID),r.emissiveMap.encoding=Ai;break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(n,e.ID);break;case"ReflectionColor":r.envMap=o.getTexture(n,e.ID),r.envMap.mapping=303,r.envMap.encoding=Ai;break;case"SpecularColor":r.specularMap=o.getTexture(n,e.ID),r.specularMap.encoding=Ai;break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(n,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),r},getTexture:function(n,i){return"LayeredTexture"in e.Objects&&i in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),i=t.get(i).children[0].ID),n.get(i)},parseDeformers:function(){var n={},i={};if("Deformer"in e.Objects){var r=e.Objects.Deformer;for(var o in r){var a=r[o],s=t.get(parseInt(o));if("Skin"===a.attrType){var l=this.parseSkeleton(s,r);l.ID=o,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=s.parents[0].ID,n[o]=l}else if("BlendShape"===a.attrType){var c={id:o};c.rawTargets=this.parseMorphTargets(s,r),c.id=o,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),i[o]=c}}}return{skeletons:n,morphTargets:i}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var i=t[e.ID];if("Cluster"===i.attrType){var r={ID:e.ID,indices:[],weights:[],transformLink:(new er).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var i=[],r=0;r<e.children.length;r++){var o=e.children[r],a=n[o.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=t.get(parseInt(o.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,i.push(s)}return i},parseScene:function(i,r,o){n=new El;var s=this.parseModels(i.skeletons,r,o),l=e.Objects.Model,c=this;s.forEach((function(e){var i=l[e.ID];c.setLookAtProperties(e,i),t.get(e.ID).parents.forEach((function(t){var n=s.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&n.add(e)})),this.bindSkeleton(i.skeletons,r,s),this.createAmbientLight(),this.setupMorphMaterials(),n.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrixWorld=e.parent.matrix);var t=g(e.userData.transformData);e.applyMatrix4(t)}}));var h=(new a).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=h,n=n.children[0]),n.animations=h},parseModels:function(n,i,r){var o=new Map,a=e.Objects.Model;for(var s in a){var l=parseInt(s),c=a[s],h=t.get(l),u=this.buildSkeleton(h,n,l,c.attrName);if(!u){switch(c.attrType){case"Camera":u=this.createCamera(h);break;case"Light":u=this.createLight(h);break;case"Mesh":u=this.createMesh(h,i,r);break;case"NurbsCurve":u=this.createCurve(h,i);break;case"LimbNode":case"Root":u=new lc;break;default:u=new El}u.name=c.attrName?dd.sanitizeNodeName(c.attrName):"",u.ID=l}this.getTransformData(u,c),o.set(l,u)}return o},buildSkeleton:function(e,t,n,i){var r=null;return e.parents.forEach((function(e){for(var o in t){var a=t[o];a.rawBones.forEach((function(t,o){if(t.ID===e.ID){var s=r;(r=new lc).matrixWorld.copy(t.transformLink),r.name=i?dd.sanitizeNodeName(i):"",r.ID=n,a.bones[o]=r,null!==s&&r.add(s)}}))}})),r},createCamera:function(t){var n,i;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(i=n)})),void 0===i)n=new yr;else{var r=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(r=1);var o=1;void 0!==i.NearPlane&&(o=i.NearPlane.value/1e3);var a=1e3;void 0!==i.FarPlane&&(a=i.FarPlane.value/1e3);var s=window.innerWidth,l=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(s=i.AspectWidth.value,l=i.AspectHeight.value);var c=s/l,h=45;void 0!==i.FieldOfView&&(h=i.FieldOfView.value);var u=i.FocalLength?i.FocalLength.value:null;switch(r){case 0:n=new va(h,c,o,a),null!==u&&n.setFocalLength(u);break;case 1:n=new pp(-s/2,s/2,l/2,-l/2,o,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),n=new yr}}return n},createLight:function(t){var n,i;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(i=n)})),void 0===i)n=new yr;else{var r;r=void 0===i.LightType?0:i.LightType.value;var o=16777215;void 0!==i.Color&&(o=(new co).fromArray(i.Color.value));var a=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(a=0);var s=0;void 0!==i.FarAttenuationEnd&&(s=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value);switch(r){case 0:n=new up(o,a,s,1);break;case 1:n=new fp(o,a);break;case 2:var l=Math.PI/3;void 0!==i.InnerAngle&&(l=Di.degToRad(i.InnerAngle.value));var c=0;void 0!==i.OuterAngle&&(c=Di.degToRad(i.OuterAngle.value),c=Math.max(c,1)),n=new cp(o,a,s,l,c,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),n=new up(o,a)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var i,r=null,o=null,a=[];return e.children.forEach((function(e){t.has(e.ID)&&(r=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))})),a.length>1?o=a:a.length>0?o=a[0]:(o=new nu({color:13421772}),a.push(o)),"color"in r.attributes&&a.forEach((function(e){e.vertexColors=!0})),r.FBX_Deformer?(a.forEach((function(e){e.skinning=!0})),(i=new rc(r,o)).normalizeSkinWeights()):i=new na(r,o),i},createCurve:function(e,t){return new bc(e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),new fc({color:3342591,linewidth:1}))},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?y(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n},setLookAtProperties:function(i,r){"LookAtProperty"in r&&t.get(i.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var r=e.Objects.Model[t.ID];if("Lcl_Translation"in r){var o=r.Lcl_Translation.value;void 0!==i.target?(i.target.position.fromArray(o),n.add(i.target)):i.lookAt((new qi).fromArray(o))}}}))},bindSkeleton:function(e,n,i){var r=this.parsePoseNodes();for(var o in e){var a=e[o];t.get(parseInt(a.ID)).parents.forEach((function(e){if(n.has(e.ID)){var o=e.ID;t.get(o).parents.forEach((function(e){i.has(e.ID)&&i.get(e.ID).bind(new sc(a.bones),r[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var i in n)if("BindPose"===n[i].attrType){var r=n[i].PoseNode;Array.isArray(r)?r.forEach((function(e){t[e.Node]=(new er).fromArray(e.Matrix.a)})):t[r.Node]=(new er).fromArray(r.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,i=t[0],r=t[1],o=t[2];if(0!==i||0!==r||0!==o){var a=new co(i,r,o);n.add(new mp(a,1))}}},setupMorphMaterials:function(){var e=this;n.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,i){e.setupMorphMaterial(t,n,i)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,i){var r=e.uuid,o=t.uuid,a=!1;if(n.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===o&&e.uuid!==r&&(a=!0)})):e.material.uuid===o&&e.uuid!==r&&(a=!0))})),!0===a){var s=t.clone();s.morphTargets=!0,void 0===i?e.material=s:e.material[i]=s}else t.morphTargets=!0}},o.prototype={constructor:o,parse:function(n){var i=new Map;if("Geometry"in e.Objects){var r=e.Objects.Geometry;for(var o in r){var a=t.get(parseInt(o)),s=this.parseGeometry(a,r[o],n);i.set(parseInt(o),s)}}return i},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,i){var r=i.skeletons,o=[],a=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==a.length){var s=t.children.reduce((function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e}),null);t.children.forEach((function(e){void 0!==i.morphTargets[e.ID]&&o.push(i.morphTargets[e.ID])}));var l=a[0],c={};"RotationOrder"in l&&(c.eulerOrder=y(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);var h=g(c);return this.genGeometry(n,s,o,h)}},genGeometry:function(e,t,n,i){var r=new Bo;e.attrName&&(r.name=e.attrName);var o=this.parseGeoNode(e,t),a=this.genBuffers(o),s=new To(a.vertex,3);if(s.applyMatrix4(i),r.setAttribute("position",s),a.colors.length>0&&r.setAttribute("color",new To(a.colors,3)),t&&(r.setAttribute("skinIndex",new Eo(a.weightsIndices,4)),r.setAttribute("skinWeight",new To(a.vertexWeights,4)),r.FBX_Deformer=t),a.normal.length>0){var l=(new Fi).getNormalMatrix(i),c=new To(a.normal,3);c.applyNormalMatrix(l),r.setAttribute("normal",c)}if(a.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),r.setAttribute(n,new To(a.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var h=a.materialIndex[0],u=0;if(a.materialIndex.forEach((function(e,t){e!==h&&(r.addGroup(u,t-u,h),h=e,u=t)})),r.groups.length>0){var p=r.groups[r.groups.length-1],d=p.start+p.count;d!==a.materialIndex.length&&r.addGroup(d,a.materialIndex.length-d,h)}0===r.groups.length&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,e,n,i),r},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var i=0;e.LayerElementUV[i];)n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:t,weight:e.weights[r]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,i=0,r=!1,o=[],a=[],s=[],l=[],c=[],h=[],u=this;return e.vertexIndices.forEach((function(p,d){var m=!1;p<0&&(p^=-1,m=!0);var v=[],g=[];if(o.push(3*p,3*p+1,3*p+2),e.color){var y=f(d,n,p,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[p]&&e.weightTable[p].forEach((function(e){g.push(e.weight),v.push(e.id)})),g.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);var x=[0,0,0,0],b=[0,0,0,0];g.forEach((function(e,t){var n=e,i=v[t];b.forEach((function(e,t,r){if(n>e){r[t]=n,n=e;var o=x[t];x[t]=i,i=o}}))})),v=x,g=b}for(;g.length<4;)g.push(0),v.push(0);for(var w=0;w<4;++w)c.push(g[w]),h.push(v[w])}if(e.normal){y=f(d,n,p,e.normal);a.push(y[0],y[1],y[2])}if(e.material&&"AllSame"!==e.material.mappingType)var _=f(d,n,p,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var i=f(d,n,p,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,m&&(u.genFace(t,e,o,_,a,s,l,c,h,i),n++,i=0,o=[],a=[],s=[],l=[],c=[],h=[])})),t},genFace:function(e,t,n,i,r,o,a,s,l,c){for(var h=2;h<c;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(h-1)]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[n[3*h]]),e.vertex.push(t.vertexPositions[n[3*h+1]]),e.vertex.push(t.vertexPositions[n[3*h+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(h-1)]),e.vertexWeights.push(s[4*(h-1)+1]),e.vertexWeights.push(s[4*(h-1)+2]),e.vertexWeights.push(s[4*(h-1)+3]),e.vertexWeights.push(s[4*h]),e.vertexWeights.push(s[4*h+1]),e.vertexWeights.push(s[4*h+2]),e.vertexWeights.push(s[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(h-1)]),e.colors.push(o[3*(h-1)+1]),e.colors.push(o[3*(h-1)+2]),e.colors.push(o[3*h]),e.colors.push(o[3*h+1]),e.colors.push(o[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[3*(h-1)]),e.normal.push(r[3*(h-1)+1]),e.normal.push(r[3*(h-1)+2]),e.normal.push(r[3*h]),e.normal.push(r[3*h+1]),e.normal.push(r[3*h+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(a[n][0]),e.uvs[n].push(a[n][1]),e.uvs[n].push(a[n][2*(h-1)]),e.uvs[n].push(a[n][2*(h-1)+1]),e.uvs[n].push(a[n][2*h]),e.uvs[n].push(a[n][2*h+1])}))},addMorphTargets:function(t,n,i,r){if(0!==i.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var o=this;i.forEach((function(i){i.rawTargets.forEach((function(i){var a=e.Objects.Geometry[i.geoID];void 0!==a&&o.genMorphGeometry(t,n,a,r,i.name)}))}))}},genMorphGeometry:function(e,t,n,i,r){for(var o=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],a=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),h=0;h<s.length;h++){var u=3*s[h];c[u]=a[3*h],c[u+1]=a[3*h+1],c[u+2]=a[3*h+2]}var p={vertexIndices:o,vertexPositions:c},d=new To(this.genBuffers(p).vertex,3);d.name=r||n.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a,r=[];return"IndexToDirect"===n&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a,r=[];return"IndexToDirect"===n&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a,r=[];return"IndexToDirect"===n&&(r=e.ColorIndex.a),{dataSize:4,buffer:i,indices:r,mappingType:t,referenceType:n}},parseMaterialIndices:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var i=e.Materials.a,r=[],o=0;o<i.length;++o)r.push(o);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===Qf)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new Bo;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Bo;for(var n,i,r=t-1,o=e.KnotVector.a,a=[],s=e.Points.a,l=0,c=s.length;l<c;l+=4)a.push((new Hi).fromArray(s,l));if("Closed"===e.Form)a.push(a[0]);else if("Periodic"===e.Form){n=r,i=o.length-1-n;for(l=0;l<r;++l)a.push(a[l])}var h=new Qf(r,o,a,n,i).getPoints(7*a.length),u=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(u,3*t)}));var p=new Bo;return p.setAttribute("position",new xo(u,3)),p}},a.prototype={constructor:a,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var i=t[n],r=this.addClip(i);e.push(r)}return e},parseClips:function(){if(void 0!==e.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var n=this.parseAnimationLayers(t);return this.parseAnimStacks(n)}},parseAnimationCurveNodes:function(){var t=e.Objects.AnimationCurveNode,n=new Map;for(var i in t){var r=t[i];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){var o={id:r.id,attr:r.attrName,curves:{}};n.set(o.id,o)}}return n},parseAnimationCurves:function(n){var i=e.Objects.AnimationCurve;for(var r in i){var o={id:i[r].id,times:i[r].KeyTime.a.map(p),values:i[r].KeyValueFloat.a},a=t.get(o.id);if(void 0!==a){var s=a.parents[0].ID,l=a.parents[0].relationship;l.match(/X/)?n.get(s).curves.x=o:l.match(/Y/)?n.get(s).curves.y=o:l.match(/Z/)?n.get(s).curves.z=o:l.match(/d|DeformPercent/)&&n.has(s)&&(n.get(s).curves.morph=o)}}},parseAnimationLayers:function(i){var r=e.Objects.AnimationLayer,o=new Map;for(var a in r){var s=[],l=t.get(parseInt(a));if(void 0!==l)l.children.forEach((function(r,o){if(i.has(r.ID)){var a=i.get(r.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===s[o])if(void 0!==(d=t.get(r.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(c=e.Objects.Model[d.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var l={modelName:c.attrName?dd.sanitizeNodeName(c.attrName):"",ID:c.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(e){e.ID===c.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new er),"PreRotation"in c&&(l.preRotation=c.PreRotation.value),"PostRotation"in c&&(l.postRotation=c.PostRotation.value),s[o]=l}s[o]&&(s[o][a.attr]=a)}else if(void 0!==a.curves.morph){if(void 0===s[o]){var c,h=t.get(r.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,u=t.get(h).parents[0].ID,p=t.get(u).parents[0].ID,d=t.get(p).parents[0].ID;l={modelName:(c=e.Objects.Model[d]).attrName?dd.sanitizeNodeName(c.attrName):"",morphName:e.Objects.Deformer[h].attrName};s[o]=l}s[o][a.attr]=a}}})),o.set(parseInt(a),s)}return o},parseAnimStacks:function(n){var i=e.Objects.AnimationStack,r={};for(var o in i){var a=t.get(parseInt(o)).children;a.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=n.get(a[0].ID);r[o]={name:i[o].attrName,layer:s}}return r},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new _u(e.name,-1,t)},generateTracks:function(e){var t=[],n=new qi,i=new ji,r=new qi;if(e.transform&&e.transform.decompose(n,i,r),n=n.toArray(),i=(new ir).setFromQuaternion(i,e.eulerOrder).toArray(),r=r.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var o=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==o&&t.push(o)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var a=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);void 0!==a&&t.push(a)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");void 0!==s&&t.push(s)}if(void 0!==e.DeformPercent){var l=this.generateMorphTrack(e);void 0!==l&&t.push(l)}return t},generateVectorTrack:function(e,t,n,i){var r=this.getTimesForAllAxes(t);return new wu(e+"."+i,r,this.getKeyframeTrackValues(r,t,n))},generateRotationTrack:function(e,t,n,i,r,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Di.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Di.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Di.degToRad));var a=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(a,t,n);void 0!==i&&((i=i.map(Di.degToRad)).push(o),i=(new ir).fromArray(i),i=(new ji).setFromEuler(i)),void 0!==r&&((r=r.map(Di.degToRad)).push(o),r=(new ir).fromArray(r),r=(new ji).setFromEuler(r).inverse());for(var l=new ji,c=new ir,h=[],u=0;u<s.length;u+=3)c.set(s[u],s[u+1],s[u+2],o),l.setFromEuler(c),void 0!==i&&l.premultiply(i),void 0!==r&&l.multiply(r),l.toArray(h,u/3*4);return new xu(e+".quaternion",a,h)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,i=t.values.map((function(e){return e/100})),r=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new gu(e.modelName+".morphTargetInfluences["+r+"]",t.times,i)},getTimesForAllAxes:function(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})).filter((function(e,t,n){return n.indexOf(e)==t}))},getKeyframeTrackValues:function(e,t,n){var i=n,r=[],o=-1,a=-1,s=-1;return e.forEach((function(e){if(t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o){var n=t.x.values[o];r.push(n),i[0]=n}else r.push(i[0]);if(-1!==a){var l=t.y.values[a];r.push(l),i[1]=l}else r.push(i[1]);if(-1!==s){var c=t.z.values[s];r.push(c),i[2]=c}else r.push(i[2])})),r},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){for(var o=r/180,a=i/o,s=n+a,l=e.times[t-1],c=(e.times[t]-l)/o,h=l+c,u=[],p=[];h<e.times[t];)u.push(h),h+=c,p.push(s),s+=a;e.times=w(e.times,t,u),e.values=w(e.values,t,p)}}}},s.prototype={constructor:s,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new h,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,i){var r=e.match(/^[\s\t]*;/),o=e.match(/^[\s\t]*$/);if(!r&&!o){var a=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");a?t.parseNodeBegin(e,a):s?t.parseNodeProperty(e,s,n[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},o=this.parseNodeAttr(i),a=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in a?("PoseNode"===n?a.PoseNode.push(r):void 0!==a[n].id&&(a[n]={},a[n][a[n].id]=a[n]),""!==o.id&&(a[n][o.id]=r)):"number"==typeof o.id?(a[n]={},a[n][o.id]=r):"Properties70"!==n&&(a[n]="PoseNode"===n?[r]:r),"number"==typeof o.id&&(r.id=o.id),""!==o.name&&(r.attrName=o.name),""!==o.type&&(r.attrType=o.type),this.pushStack(r)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}},parseNodeProperty:function(e,t,n){var i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===i){var a=r.split(",").slice(1),s=parseInt(a[0]),l=parseInt(a[1]),c=r.split(",").slice(3);i="connections",function(e,t){for(var n=0,i=e.length,r=t.length;n<r;n++,i++)e[i]=t[n]}(r=[s,l],c=c.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===o[i]&&(o[i]=[])}"Node"===i&&(o.id=r),i in o&&Array.isArray(o[i])?o[i].push(r):"a"!==i?o[i]=r:o.a=r,this.setCurrentProp(o,i),"a"===i&&","!==r.slice(-1)&&(o.a=x(r))}else this.parseNodeSpecialProperty(e,i,r)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=x(t.a))},parseNodeSpecialProperty:function(e,t,n){var i=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),r=i[0],o=i[1],a=i[2],s=i[3],l=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=x(l)}this.getPrevNode()[r]={type:o,type2:a,flag:s,value:l},this.setCurrentProp(this.getPrevNode(),r)}},l.prototype={constructor:l,parse:function(e){var t=new c(e);t.skip(23);var n=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+n);for(var i=new h;!this.endOfContent(t);){var r=this.parseNode(t,n);null!==r&&i.add(r.name,r)}return i},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var o=e.getUint8(),a=e.getString(o);if(0===i)return null;for(var s=[],l=0;l<r;l++)s.push(this.parseProperty(e));var c=s.length>0?s[0]:"",h=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=1===r&&e.getOffset()===i;i>e.getOffset();){var p=this.parseNode(e,t);null!==p&&this.parseSubNode(a,n,p)}return n.propertyList=s,"number"==typeof c&&(n.id=c),""!==h&&(n.attrName=h),""!==u&&(n.attrType=u),""!==a&&(n.name=a),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if("Connections"===e&&"C"===n.name){var r=[];n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var o,a=n.propertyList[0],s=n.propertyList[1],l=n.propertyList[2],c=n.propertyList[3];0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),o="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[a]={type:s,type2:l,flag:c,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":n=e.getUint32();return e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var i=e.getUint32(),r=e.getUint32(),o=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}void 0===Xf&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var a=new c(new Xf.Inflate(new Uint8Array(e.getArrayBuffer(o))).decompress().buffer);switch(t){case"b":case"c":return a.getBooleanArray(i);case"d":return a.getFloat64Array(i);case"f":return a.getFloat32Array(i);case"i":return a.getInt32Array(i);case"l":return a.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},c.prototype={constructor:c,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),bp(new Uint8Array(t))}},h.prototype={constructor:h,add:function(e,t){this[e]=t}};var d=[];function f(e,t,n,i){var r;switch(i.mappingType){case"ByPolygonVertex":r=e;break;case"ByPolygon":r=t;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);var o=r*i.dataSize,a=o+i.dataSize;return function(e,t,n,i){for(var r=n,o=0;r<i;r++,o++)e[o]=t[r];return e}(d,i.buffer,o,a)}var m=new ir,v=new qi;function g(e){var t,n=new er,i=new er,r=new er,o=new er,a=new er,s=new er,l=new er,c=new er,h=new er,u=new er,p=new er,d=e.inheritType?e.inheritType:0;(e.translation&&n.setPosition(v.fromArray(e.translation)),e.preRotation)&&((t=e.preRotation.map(Di.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(m.fromArray(t)));e.rotation&&((t=e.rotation.map(Di.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(m.fromArray(t)));e.postRotation&&((t=e.postRotation.map(Di.degToRad)).push(e.eulerOrder),o.makeRotationFromEuler(m.fromArray(t)));e.scale&&a.scale(v.fromArray(e.scale)),e.scalingOffset&&l.setPosition(v.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(v.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(v.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition(v.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(u=e.parentMatrixWorld);var f=i.multiply(r).multiply(o),g=new er;u.extractRotation(g),(new er).copyPosition(u);var y=new er;y.getInverse(g).multiply(u);var x=new er;if(0===d)x.copy(g).multiply(f).multiply(y).multiply(a);else if(1===d)x.copy(g).multiply(y).multiply(f).multiply(a);else{var b=(new er).getInverse(a),w=(new er).multiply(y).multiply(b);x.copy(g).multiply(f).multiply(w).multiply(a)}var _=(new er).getInverse(h),M=(new er).getInverse(s),E=new er;E.copy(n).multiply(c).multiply(h).multiply(i).multiply(r).multiply(o).multiply(_).multiply(l).multiply(s).multiply(a).multiply(M);var S=(new er).copyPosition(E),A=(new er).copy(u).multiply(S);return p.copyPosition(A),E=(new er).multiply(p).multiply(x)}function y(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function x(e){return e.split(",").map((function(e){return parseFloat(e)}))}function b(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),bp(new Uint8Array(e,t,n))}function w(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return i}();const Jf=(e,t,n)=>{const i=new a.Matrix4,r=new a.Euler(e,t,n,"YXZ");return i.makeRotationFromEuler(r),i};function Kf(e,n){e.traverse((e=>{var i;if("Mesh"===e.type){const r=e,o=Object.assign({map:r.material.map||{}},n);r.material=new t.MeshBasicMaterial(o),r.renderOrder=1,"Mesh"===(null==(i=e.parent)?void 0:i.type)&&(e.renderOrder=e.parent.renderOrder+1)}}))}function $f(e,n){var i,r,o,a,s;const l=null!=(i=null==n?void 0:n.size)?i:512,c=null!=(r=null==n?void 0:n.fontSize)?r:l*(35/256)*1.2,h=null!=(o=null==n?void 0:n.backgroundColor)?o:"rgba(0,0,0,0)",u=null!=(a=null==n?void 0:n.fontColor)?a:"#fff",p=null!=(s=null==n?void 0:n.textAlign)?s:"center",d=document.createElement("canvas");d.setAttribute("width",l+""),d.setAttribute("height",l+"");const f=d.getContext("2d");return f.fillStyle=h,f.fillRect(0,0,l,l),f.font=`${c}px "微软雅黑"`,f.textAlign=p,f.fillStyle=u,f.fillText(e,l/2,.7*l),new t.CanvasTexture(d)}var em,tm={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-tm.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*tm.Bounce.In(2*e):.5*tm.Bounce.Out(2*e-1)+.5}}},nm="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},im=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=nm()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],o=!t;r&&!1===r.update(e,o)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),rm={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),o=rm.Utils.Linear;return t<0?o(e[0],e[1],i):t>1?o(e[n],e[n-1],n-i):o(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,o=rm.Utils.Bernstein,a=0;a<=i;a++)n+=r(1-t,i-a)*r(t,a)*e[a]*o(i,a);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),o=rm.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),o(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):o(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=rm.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(em=[1],function(e){var t=1;if(em[e])return em[e];for(var n=e;n>1;n--)t*=n;return em[e]=t,t}),CatmullRom:function(e,t,n,i,r){var o=.5*(n-e),a=.5*(i-t),s=r*r;return(2*t-2*n+o+a)*(r*s)+(-3*t+3*n-2*o-a)*s+o*r+t}}},om=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),am=new im,sm=function(){function e(e,t){void 0===t&&(t=am),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=tm.Linear.None,this._interpolationFunction=rm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=om.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?nm()+parseFloat(e):e:nm(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var o=e[r],a=Array.isArray(o),s=a?"array":typeof o,l=!a&&Array.isArray(n[r]);if("undefined"!==s&&"function"!==s){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,o)),n[r]=[o].concat(c)}if("object"!==s&&!a||!o||l)void 0===t[r]&&(t[r]=o),a||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var h in t[r]=a?[]:{},o)t[r][h]=o[h];i[r]=a?[]:{},this._setupProperties(o,t[r],n[r],i[r])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=nm()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=nm()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=nm()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var o=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,s=this._chainedTweens.length;a<s;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var o=t[r]||0,a=n[r],s=Array.isArray(e[r]),l=Array.isArray(a);!s&&l?e[r]=this._interpolationFunction(a,i):"object"==typeof a&&a?this._updateProperties(e[r],o,a,i):"number"==typeof(a=this._handleRelativeValue(o,a))&&(e[r]=o+(a-o)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),lm=om.nextId,cm=am,hm=cm.getAll.bind(cm),um=cm.removeAll.bind(cm),pm=cm.add.bind(cm),dm=cm.remove.bind(cm),fm=cm.update.bind(cm),mm={Easing:tm,Group:im,Interpolation:rm,now:nm,Sequence:om,nextId:lm,Tween:sm,VERSION:"18.6.4",getAll:hm,removeAll:um,add:pm,remove:dm,update:fm};const vm=window.requestAnimationFrame||(e=>setTimeout(e,16)),gm=window.cancelAnimationFrame||clearTimeout;function ym(e,t=0){vm(t<=0?e:()=>ym(e,t-1))}function xm(e,t=60){let n=-1,i=0,r=-1;const o=1e3/t;return n=vm((function t(a){-1===r&&(r=a),n=vm(t),a-i<o||(i=a,e&&e(a-r))})),function(){gm(n)}}const bm=tm;function wm(e,t,n,i=bm.Linear.None){const r=new sm(e).to(t,n).easing(i);ym((()=>r.start(0)));const o=xm((e=>{!1===r.update(e)&&o()})),a=[];return r.onDestroy=e=>(a.push(e),r),r.destroy=function(){let e;for(this.stop(),Object.assign(r,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});e=a.shift();)e();o()},r}var _m=(e=>(e.Clockwise="Clockwise",e.Anticlockwise="Anticlockwise",e.Loop="Loop",e))(_m||{});const Mm=2*Math.PI;function Em(e){return(e%Mm+Mm)%Mm}function Sm(e){return e%Mm}function Am(e,t,n){return e+(t-e)*n}const Tm=(e,t,n)=>{const i=Math.PI,r=2*i;return e=Em(e),t=Em(t),n===_m.Anticlockwise&&e<t&&(e+=r),n===_m.Clockwise&&t<e&&(t+=r),n===_m.Loop&&t-e>i?Tm(e,t,_m.Anticlockwise):n===_m.Loop&&e-t>i?Tm(e,t,_m.Clockwise):{from:e,to:t}};function Pm(e,t){return e.x===t.x&&e.y===t.y}function Lm(e,t){return Math.abs(e)===1/0&&Math.abs(t)===1/0||Math.abs(e-t)<.001}function Cm(e,t){return(t.y-e.y)/(t.x-e.x)}function Im(e,t,n){const i=Cm(e[1],e[0]),r=Cm(t[1],t[0]);if(isNaN(i)||isNaN(r))return!1;if(Lm(i,r))return!1;if(Rm(e[0],t))return e[0];if(Rm(e[1],t))return e[1];if(Rm(t[0],e))return t[0];if(Rm(t[1],e))return t[1];if(n&&!function(e,t){return Math.max(e[0].x,e[1].x)>=Math.min(t[0].x,t[1].x)&&Math.max(t[0].x,t[1].x)>=Math.min(e[0].x,e[1].x)&&Math.max(e[0].y,e[1].y)>=Math.min(t[0].y,t[1].y)&&Om(t[0],e[1],e[0])*Om(e[1],t[1],e[0])>0&&Om(e[0],t[1],t[0])*Om(t[1],e[1],t[0])>0?1:0}(e,t))return!1;const o=e[0],a=t[0];if(Math.abs(i)===1/0)return{x:o.x,y:t[1].y-(t[1].x-o.x)*r};if(Math.abs(r)===1/0)return{x:a.x,y:e[1].y-(e[1].x-a.x)*i};const s=(a.y-o.y+i*o.x-r*a.x)/(i-r);return{x:s,y:i*s-i*o.x+o.y}}function Rm(e,t){return!!Pm(e,t[0])||(!!Pm(e,t[1])||(t[0].x-e.x)*(e.x-t[1].x)>=0&&(t[0].y-e.y)*(e.y-t[1].y)>=0&&Lm(Cm(t[0],e),Cm(e,t[1])))}function Om(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function Dm(e,t=0){t<=0?requestAnimationFrame(e):requestAnimationFrame((()=>Dm(e,t-1)))}const Nm=new a.TextureLoader;async function Fm(e){return new Promise(((t,n)=>{Nm.load(e,t,void 0,n)})).then((e=>(e.encoding=a.sRGBEncoding,e)))}class zm extends mm.Tween{constructor(){super(...arguments),__publicField(this,"disposeMethods",[]),__publicField(this,"animationFrameDisposer"),__publicField(this,"onDispose",(e=>(this.disposeMethods.push(e),this))),__publicField(this,"play",(()=>(this.start(0),this.animationFrameDisposer=xm((e=>this.update(e))),this))),__publicField(this,"dispose",(()=>{var e;this.stop(),null==(e=this.animationFrameDisposer)||e.call(this),this.disposeMethods.forEach((e=>e())),this.disposeMethods=[],mm.remove(this)}))}}function Bm(e,t=mm.Easing.Linear.None){const n=new zm({progress:0}).to({progress:1});return void 0!==e&&n.duration(e),void 0!==t&&n.easing(t),n}class km{constructor(e,t){__publicField(this,"five"),__publicField(this,"data"),__publicField(this,"config"),__publicField(this,"group",new a.Group),__publicField(this,"modelLoaded",!1),__publicField(this,"roomInfoInstance"),__publicField(this,"roomInfoWrapperInstance"),__publicField(this,"compassMeshTween"),__publicField(this,"compassMesh"),__publicField(this,"entryDoorMesh"),__publicField(this,"dispose",(()=>{var e,t,n,i;this.five.scene.remove(this.group),this.group.remove(...this.group.children),null==(t=null==(e=this.compassMesh)?void 0:e.material.map)||t.dispose(),null==(i=null==(n=this.entryDoorMesh)?void 0:n.material.map)||i.dispose(),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive)})),__publicField(this,"onFiveFistPanoLoaded",(()=>{this.modelLoaded=!0,this.data&&this.init()})),__publicField(this,"onFivePanoWillArrive",(e=>{var t,n;e!==this.five.panoIndex&&(null==(t=this.compassMeshTween)||t.dispose(),null==(n=this.compassMesh)||n.material.setValues({opacity:0}))})),__publicField(this,"onFivePanoArrived",(e=>{var t,n,i,r;const o=this.five.work.observers[e].standingPosition;if(this.compassMesh){if(this.compassMesh.position.copy(o.clone().setY(o.y+.01)),0!==this.compassMesh.material.opacity)return;null==(t=this.compassMeshTween)||t.dispose(),this.compassMeshTween=Bm(1e3).onUpdate((({progress:e})=>{var t;null==(t=this.compassMesh)||t.material.setValues({opacity:e}),this.five.needsRender=!0})).play()}if(this.entryDoorMesh){const t=new a.Vector3(this.data.entrance.position.x,this.data.entrance.position.y,this.data.entrance.position.z).clone().setY(o.y).sub(o).normalize(),s=o.clone().add(t.clone().multiplyScalar(.7)).setY(o.y+.01);this.entryDoorMesh.rotation.z=new a.Vector3(0,0,-1).angleTo(t),this.entryDoorMesh.position.copy(s),1===(null==(n=this.data)?void 0:n.room_observers[e].room.type)?null==(i=this.entryDoorMesh)||i.material.setValues({opacity:1}):null==(r=this.entryDoorMesh)||r.material.setValues({opacity:0})}this.roomInfoInstance&&this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.position.copy(o.clone().setY(o.y+.01)),this.roomInfoInstance.setRoom(this.data.room_observers[e].room)),this.five.needsRender=!0})),__publicField(this,"onFiveCameraDirectionUpdate",(({longitude:e,latitude:t})=>{var n,i;this.roomInfoWrapperInstance&&(this.roomInfoWrapperInstance.css3DObject.rotation.z=e,t>.66&&"Panorama"===this.five.getCurrentState().mode?null==(n=this.roomInfoInstance)||n.show():null==(i=this.roomInfoInstance)||i.hide())})),this.five=e,this.config=t,this.five.scene.add(this.group),e.once("dispose",this.dispose),e.once("modelLoaded",this.onFiveFistPanoLoaded),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("cameraDirectionUpdate",this.onFiveCameraDirectionUpdate)}load(e){this.data=e,this.modelLoaded&&this.init()}async init(){if(!this.data||!this.modelLoaded)return;const e=this.data.north_rad;null!=e&&(this.compassMesh=await this.loadCompassMesh(),this.compassMesh.rotateX(-Math.PI/2),this.compassMesh.rotateZ(e-Math.PI/2),this.group.add(this.compassMesh)),null!=this.data.entrance&&(this.entryDoorMesh=await this.loadEntryDoorMesh(),this.roomInfoWrapperInstance=this.loadRoomInfo(),this.roomInfoInstance=function(){const e=document.createElement("div"),t=document.createElement("i"),n=document.createElement("span");return e.appendChild(t),e.appendChild(n),e.style.position="relative",e.style.width="100%",e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.marginTop="9.375rem",e.style.opacity="0",e.style.transition="opacity 1000ms linear",t.style.display="block",t.style.width="8.375rem",t.style.height="1.375rem",t.style.backgroundSize="100%",t.style.backgroundRepeat="no-repeat",t.style.backgroundImage="url(data:image/png;base64,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)",n.style.marginTop="0.625rem",n.style.fontSize="1rem",n.style.color="#fff",n.style.opacity="0.7",n.style.textShadow="0 2px 16px rgb(22 34 83 / 24%)",n.style.fontWeight="bold",{appendTo(t){t.appendChild(e)},dispose(){e.remove()},setRoom(e){n.innerHTML=e.name+" "+Math.floor(e.size/1e6)+"㎡"},show(){e.style.opacity="1"},hide(){e.style.opacity="0"}}}(),this.entryDoorMesh.rotateX(-Math.PI/2),this.roomInfoWrapperInstance&&this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container),this.group.add(this.entryDoorMesh)),this.onFivePanoArrived(this.five.panoIndex||0),this.five.needsRender=!0}async loadCompassMesh(){var e;const t=(null==(e=this.config)?void 0:e.compassImageUrl)||"//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png",n=await Fm(t),i=new a.CircleGeometry(.7,32),r=new a.MeshBasicMaterial({map:n,transparent:!0,opacity:0,depthTest:!1}),o=new a.Mesh(i,r);return o.name="pano-compass-mesh",o}async loadEntryDoorMesh(){var e;const t=(null==(e=this.config)?void 0:e.entryDoorImageUrl)||"//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png",n=await Fm(t),i=new a.PlaneGeometry(.2,.16),r=new a.MeshBasicMaterial({map:n,transparent:!0,opacity:.8,depthTest:!1}),o=new a.Mesh(i,r);return o.name="pano-compass-entry-door",o}loadRoomInfo(){const e=[new a.Vector3(-.7,0,-.7),new a.Vector3(.7,0,-.7),new a.Vector3(.7,0,.7),new a.Vector3(-.7,0,.7)];return c(this.five).create3DDomContainer(e)}}function Hm(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}class Um{constructor(e,t){if(__publicField(this,"five"),__publicField(this,"scale"),__publicField(this,"width"),__publicField(this,"height"),__publicField(this,"pixelRatio"),__publicField(this,"originWidth"),__publicField(this,"originHeight"),__publicField(this,"context"),__publicField(this,"canvas",document.createElement("canvas")),__publicField(this,"container"),!e.renderer)throw new Error("Five Render 未初始化");this.five=e;const n=t.scale,i=e.renderer.getPixelRatio(),r=t.width,o=t.height,a=r*i,s=o*i,l=this.canvas,c=this.canvas.getContext("2d");if(!c)throw new Error("CANNOT CREATE CONTEXT2D");this.scale=n,this.context=c,this.width=a,this.height=s,this.originWidth=r,this.originHeight=o,this.pixelRatio=i,l.classList.add("plugin-measure-magnifier"),l.style.position="absolute",l.style.pointerEvents="none",l.style.borderRadius="50%",l.style.left=-a/2+"px",l.style.top=-s-90+"px",l.setAttribute("width",a.toString()),l.setAttribute("height",s.toString()),this.canvas.style.width=r+"px",this.canvas.style.height=o+"px"}dispose(){this.clear(),this.canvas.remove()}clear(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height)}appendTo(e){this.container=e,e.append(this.canvas)}updateWithPoint(e){if(!this.five.renderer||!this.container)return;const{scale:n,pixelRatio:i,context:r,originWidth:o,originHeight:a,width:s,height:l}=this,c=e.clone().project(this.five.camera),h=(c.x+1)/2*this.container.clientWidth,u=-(c.x-1)/2*this.container.clientWidth,p=-(c.y-1)/2*this.container.clientHeight;h<183?(this.canvas.style.top=-a/2+"px",this.canvas.style.left="90px"):p<183?(this.canvas.style.top="90px",this.canvas.style.left=-o/2+"px"):u<183?(this.canvas.style.top=-a/2+"px",this.canvas.style.left=-o-90+"px"):(this.canvas.style.left=-o/2+"px",this.canvas.style.top=-a-90+"px"),this.canvas.style.transform=`translate3d(${h}px, ${p}px, 10px)`;const d=this.five.renderer.getSize(new t.Vector2),f=(c.x+1)/2*d.x,m=(c.y+1)/2*d.y,v=this.five.getPixels(f-o/n/2,m-a/n/2,o/n,a/n,i*n),g=s*l/2;for(let t=0;t<g;t++){const e=(l-Math.floor(t/s)-1)*s+t%s;Hm(v,4*t+0,4*e+0),Hm(v,4*t+1,4*e+1),Hm(v,4*t+2,4*e+2),Hm(v,4*t+3,4*e+3)}const y=r.createImageData(s,l);y.data.set(v),r.putImageData(y,0,0)}}class Gm{constructor(e){__publicField(this,"edges",[]),__publicField(this,"five"),__publicField(this,"onModelLoaded",(()=>{this.five.model&&(this.edges=this.five.model.getEdges())})),this.five=e,this.five.model.loaded?this.onModelLoaded():this.five.on("modelLoaded",this.onModelLoaded)}dispose(){}getAdsorbentPoint(e){if(0===this.edges.length)return null;let n,i=1/0;return this.edges.forEach((r=>{const o=r.closestPointToPoint(e.point,!0,new t.Vector3),a=o.distanceTo(e.point);a<i&&(n=o,i=a)})),i>.1?null:n||null}}var jm,Vm={exports:{}};
3
+ /*! Hammer.JS - v2.0.7 - 2016-04-22
4
+ * http://hammerjs.github.io/
5
+ *
6
+ * Copyright (c) 2016 Jorik Tangelder;
7
+ * Licensed under the MIT license */jm=Vm,function(e,t,n,i){var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),s=Math.round,l=Math.abs,c=Date.now;function h(e,t,n){return setTimeout(g(e,n),t)}function u(e,t,n){return!!Array.isArray(e)&&(p(e,n[t],n),!0)}function p(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function d(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=d((function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),m=d((function(e,t){return f(e,t,!0)}),"merge","Use `assign`.");function v(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return"function"==typeof e?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function b(e,t,n){p(E(t),(function(t){e.addEventListener(t,n,!1)}))}function w(e,t,n){p(E(t),(function(t){e.removeEventListener(t,n,!1)}))}function _(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function M(e,t){return e.indexOf(t)>-1}function E(e){return e.trim().split(/\s+/g)}function S(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function A(e){return Array.prototype.slice.call(e,0)}function T(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];S(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort((function(e,n){return e[t]>n[t]})):i.sort()),i}function P(e,t){for(var n,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(n=o[s])?n+a:t)in e)return r;s++}return i}var L=1;function C(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var I="ontouchstart"in e,R=P(e,"PointerEvent")!==i,O=I&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),D="touch",N="mouse",F=24,z=["x","y"],B=["clientX","clientY"];function k(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}function H(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=1&t&&r-o==0,s=12&t&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=U(t)),o>1&&!n.firstMultiple?n.firstMultiple=U(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,h=s?s.center:a.center,u=t.center=G(r);t.timeStamp=c(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=q(h,u),t.distance=W(h,u),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};1!==t.eventType&&4!==o.eventType||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=V(t.deltaX,t.deltaY);var p,d,f=j(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=f.x,t.overallVelocityY=f.y,t.overallVelocity=l(f.x)>l(f.y)?f.x:f.y,t.scale=s?(p=s.pointers,W((d=r)[0],d[1],B)/W(p[0],p[1],B)):1,t.rotation=s?function(e,t){return q(t[1],t[0],B)+q(e[1],e[0],B)}(s.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,r,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(8!=t.eventType&&(c>25||s.velocity===i)){var h=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,p=j(c,h,u);r=p.x,o=p.y,n=l(p.x)>l(p.y)?p.x:p.y,a=V(h,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var m=e.element;_(t.srcEvent.target,m)&&(m=t.srcEvent.target),t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function U(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:c(),pointers:t,center:G(t),deltaX:e.deltaX,deltaY:e.deltaY}}function G(e){var t=e.length;if(1===t)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:s(n/t),y:s(i/t)}}function j(e,t,n){return{x:t/e||0,y:n/e||0}}function V(e,t){return e===t?1:l(e)>=l(t)?e<0?2:4:t<0?8:16}function W(e,t,n){n||(n=z);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function q(e,t,n){n||(n=z);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}k.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(C(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(C(this.element),this.evWin,this.domHandler)}};var X={mousedown:1,mousemove:2,mouseup:4},Y="mousedown",Q="mousemove mouseup";function Z(){this.evEl=Y,this.evWin=Q,this.pressed=!1,k.apply(this,arguments)}v(Z,k,{handler:function(e){var t=X[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:N,srcEvent:e}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},K={2:D,3:"pen",4:N,5:"kinect"},$="pointerdown",ee="pointermove pointerup pointercancel";function te(){this.evEl=$,this.evWin=ee,k.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&($="MSPointerDown",ee="MSPointerMove MSPointerUp MSPointerCancel"),v(te,k,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=J[i],o=K[e.pointerType]||e.pointerType,a=o==D,s=S(t,e.pointerId,"pointerId");1&r&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):12&r&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var ne={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",re="touchstart touchmove touchend touchcancel";function oe(){this.evTarget=ie,this.evWin=re,this.started=!1,k.apply(this,arguments)}function ae(e,t){var n=A(e.touches),i=A(e.changedTouches);return 12&t&&(n=T(n.concat(i),"identifier",!0)),[n,i]}v(oe,k,{handler:function(e){var t=ne[e.type];if(1===t&&(this.started=!0),this.started){var n=ae.call(this,e,t);12&t&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:D,srcEvent:e})}}});var se={touchstart:1,touchmove:2,touchend:4,touchcancel:8},le="touchstart touchmove touchend touchcancel";function ce(){this.evTarget=le,this.targetIds={},k.apply(this,arguments)}function he(e,t){var n=A(e.touches),i=this.targetIds;if(3&t&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],l=this.target;if(o=n.filter((function(e){return _(e.target,l)})),1===t)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<a.length;)i[a[r].identifier]&&s.push(a[r]),12&t&&delete i[a[r].identifier],r++;return s.length?[T(o.concat(s),"identifier",!0),s]:void 0}function ue(){k.apply(this,arguments);var e=g(this.handler,this);this.touch=new ce(this.manager,e),this.mouse=new Z(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function pe(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,de.call(this,t)):12&e&&de.call(this,t)}function de(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)}),2500)}}function fe(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=25&&a<=25)return!0}return!1}v(ce,k,{handler:function(e){var t=se[e.type],n=he.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:D,srcEvent:e})}}),v(ue,k,{handler:function(e,t,n){var i=n.pointerType==D,r=n.pointerType==N;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)pe.call(this,t,n);else if(r&&fe.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var me=P(a.style,"touchAction"),ve=me!==i,ge="compute",ye="auto",xe="manipulation",be="none",we="pan-x",_e="pan-y",Me=function(){if(!ve)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){t[i]=!n||e.CSS.supports("touch-action",i)})),t}();function Ee(e,t){this.manager=e,this.set(t)}Ee.prototype={set:function(e){e==ge&&(e=this.compute()),ve&&this.manager.element.style&&Me[e]&&(this.manager.element.style[me]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return p(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(M(e,be))return be;var t=M(e,we),n=M(e,_e);return t&&n?be:t||n?t?we:_e:M(e,xe)?xe:ye}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=M(i,be)&&!Me.none,o=M(i,_e)&&!Me["pan-y"],a=M(i,we)&&!Me["pan-x"];if(r){var s=1===e.pointers.length,l=e.distance<2,c=e.deltaTime<250;if(s&&l&&c)return}if(!a||!o)return r||o&&6&n||a&&n&F?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Se=32;function Ae(e){this.options=r({},this.defaults,e||{}),this.id=L++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Te(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Pe(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function Le(e,t){var n=t.manager;return n?n.get(e):e}function Ce(){Ae.apply(this,arguments)}function Ie(){Ce.apply(this,arguments),this.pX=null,this.pY=null}function Re(){Ce.apply(this,arguments)}function Oe(){Ae.apply(this,arguments),this._timer=null,this._input=null}function De(){Ce.apply(this,arguments)}function Ne(){Ce.apply(this,arguments)}function Fe(){Ae.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ze(e,t){return(t=t||{}).recognizers=x(t.recognizers,ze.defaults.preset),new Be(e,t)}function Be(e,t){var n;this.options=r({},ze.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(R?te:O?ce:I?ue:Z))(n,H),this.touchAction=new Ee(this,this.options.touchAction),ke(this,!0),p(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function ke(e,t){var n,i=e.element;i.style&&(p(e.options.cssProps,(function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}Ae.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(u(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Le(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return u(e,"dropRecognizeWith",this)||(e=Le(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(u(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Le(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(u(e,"dropRequireFailure",this))return this;e=Le(e,this);var t=S(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<8&&i(t.options.event+Te(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=8&&i(t.options.event+Te(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Se},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!y(this.options.enable,[this,t]))return this.reset(),void(this.state=Se);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(Ce,Ae,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,r=this.attrTest(e);return i&&(8&n||!r)?16|t:i||r?4&n?8|t:2&t?4|t:2:Se}}),v(Ie,Ce,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(_e),e&F&&t.push(we),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(6&t.direction?(r=0===o?1:o<0?2:4,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?1:a<0?8:16,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Ce.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Pe(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Re,Ce,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Oe,Ae,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ye]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||12&e.eventType&&!r)this.reset();else if(1&e.eventType)this.reset(),this._timer=h((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Se},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}}),v(De,Ce,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ne,Ce,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Ie.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return 30&n?t=e.overallVelocity:6&n?t=e.overallVelocityX:n&F&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Pe(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Fe,Ae,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[xe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(i&&r&&n){if(4!=e.eventType)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||W(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=h((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Se},failTimeout:function(){return this._timer=h((function(){this.state=Se}),this.options.interval,this),Se},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ze.VERSION="2.0.7",ze.defaults={domEvents:!1,touchAction:ge,enable:!0,inputTarget:null,inputClass:null,preset:[[De,{enable:!1}],[Re,{enable:!1},["rotate"]],[Ne,{direction:6}],[Ie,{direction:6},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[Oe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Be.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&8&r.state)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&14&n.state&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof Ae)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(u(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(u(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=S(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return p(E(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==i){var n=this.handlers;return p(E(e),(function(e){t?n[e]&&n[e].splice(S(n[e],t),1):delete n[e]})),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var i=t.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=n,n.target.dispatchEvent(i)}(e,n);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](n),r++}},destroy:function(){this.element&&ke(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(ze,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Se,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:F,DIRECTION_ALL:30,Manager:Be,Input:k,TouchAction:Ee,TouchInput:ce,MouseInput:Z,PointerEventInput:te,TouchMouseInput:ue,SingleTouchInput:oe,Recognizer:Ae,AttrRecognizer:Ce,Tap:Fe,Pan:Ie,Swipe:Ne,Pinch:Re,Rotate:De,Press:Oe,on:b,off:w,each:p,merge:m,extend:f,assign:r,inherit:v,bindFn:g,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=ze,jm.exports?jm.exports=ze:e.Hammer=ze}(window,document);var Wm=Vm.exports;function qm(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function Xm(){return(qm()+qm()+"-"+qm()+"-4"+qm().substr(0,3)+"-"+qm()+"-"+qm()+qm()+qm()).toLowerCase()}class Ym{constructor(){__publicField(this,"id",Xm()),__publicField(this,"points",[]),__publicField(this,"lines",[])}push(e){const t=this.getNext(e);if(!t)throw new Error("当前线段于上一条线段无法构成折线");return this.lines.push(t.line),this.points.push(...t.points),this.lines.length}pop(){const e=this.lines.pop();return 0===this.lines.length?this.points.slice(0,this.points.length):this.points.pop(),e}getNext(e){const t=this.points.slice(-1)[0];if(!t)return{line:e,points:e.points};if(!e.points.includes(t))return null;const n=e.points.find((e=>e!==t));return n?{line:e,points:[n]}:null}toJson(){return{id:this.id,lines:this.lines.map((e=>e.id)),points:this.points.map((e=>e.id))}}toCompletelyJson(){return{id:this.id,points:this.points.map((e=>e.toJson())),lines:this.lines.map((e=>e.toCompletelyJson()))}}}const Qm=new t.Color(16777215),Zm=new t.Color(2981119),Jm=new t.Color(16777215),Km=new t.Color(2981119),$m=(new t.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg=="),ev={pointTexture:$m,pointSize:8,lineWidth:2,lineColor:Qm,pointColor:Jm,lineRenderOrder:20,pointsRenderOrder:20};Object.assign({},ev,{dashed:!0});const tv={pointTexture:$m,pointSize:16,lineWidth:4,lineColor:Zm,pointColor:Km,lineRenderOrder:10,pointsRenderOrder:10};function nv(e,n){const[r,o]=e.points,a="light"===n?tv:ev,s=function(e,n,r){var o,a,s,l,c;const h=null!=(o=null==r?void 0:r.lineWidth)?o:2,u=null!=(a=null==r?void 0:r.lineColor)?a:new t.Color(16777215),p=null!=(s=null==r?void 0:r.pointSize)?s:5,d=null!=(l=null==r?void 0:r.lineRenderOrder)?l:10,f=null!=(c=null==r?void 0:r.lineRenderOrder)?c:20,m=new i.Line(e,n);m.setMaterial({linewidth:h,color:u}),m.line.material.depthTest=!1,m.line.material.transparent=!0,m.line.renderOrder=d,m.points.renderOrder=f;const v=m.points.material;return v.depthTest=!1,v.size=p,(null==r?void 0:r.pointColor)&&v.color.set(r.pointColor).convertSRGBToLinear(),(null==r?void 0:r.pointTexture)&&(v.map=r.pointTexture),m}(r.position,o.position,a);return s.name="normalLine_"+e.id,s}function iv(e){const{x:t,y:n,z:i}=e;return!(Math.abs(t)>1||Math.abs(n)>1||Math.abs(i)>1)}function rv(e){function n(){var t;i(),null==(t=e.clickCallback)||t.call(e,c)}function i(){if(l)return l.highlight();a.style.border="1px solid #538FFF",a.style.color="#538FFF"}const{line:r}=e,o=r.id,a=function(){const e=document.createElement("div");return e.style.height="24px",e.style.width="62px",e.style.lineHeight="24px",e.style.textAlign="center",e.style.transform="translate(-50%, -50%)",e.style.borderRadius="12px",e.style.fontSize="14px",e.style.color="#000000",e.style.background="#fff",e.style.pointerEvents="all",e.style.cursor="pointer",e}(),s=function(e){const t=document.createElement("div");return t.id="distance_"+e.id,t.classList.add("five-plugin-measure__distance"),t.style.opacity="0",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.transform="translate3d(0, 0, 0)",t}(r),l=e.userDistanceItem,c={lineID:o,ndcPosition:new t.Vector3(0,0,0),update:function(e){const n=e.getElement();if(!n)return;const i=n.clientWidth,o=n.clientHeight;if(r.points.length<2)return;const[c,h]=r.points,u=c.position.clone().project(e.camera),p=h.position.clone().project(e.camera),d=u.clone().lerp(p,.5);if(!1===(()=>{if(Math.abs(u.z)>1||Math.abs(p.z)>1)return!1;if(!iv(u)&&!iv(p))return!1;if(!iv(d))return!1;const e=new t.Vector2(u.x*i,u.y*o),n=new t.Vector2(p.x*i,p.y*o);return!(e.distanceTo(n)<20)})())return s.style.opacity="0",void(s.style.pointerEvents="none");const f=(d.x+1)/2*i,m=-(d.y-1)/2*o;s.style.transform=`translate3d(${f}px, ${m}px, 10px)`,s.style.opacity="1",s.style.pointerEvents="all",l&&l.update({line:r.toCompletelyJson(),polyline:r.getPolyline().toCompletelyJson()});const v=c.position.clone().distanceTo(h.position).toFixed(2)+"m";a.innerText!==v&&(a.innerText=v)},appendTo:function(e){e.appendChild(s),s.addEventListener("click",n)},remove:function(){a.removeEventListener("click",n),s.remove()},highlight:i,unHighlight:function(){if(l)return l.unHighlight();a.style.border="none",a.style.color="#000"}};return(null==l?void 0:l.element)?s.appendChild(l.element):s.appendChild(a),c}class ov{constructor(e,t,n){if(__publicField(this,"id"),__publicField(this,"selected",!1),__publicField(this,"type","line"),__publicField(this,"model"),__publicField(this,"mesh"),__publicField(this,"points"),__publicField(this,"lightMesh"),__publicField(this,"hook"),__publicField(this,"distanceItem"),__publicField(this,"polyline"),this.id=Xm(),this.model=n,e.id===t.id)throw new Error("无效的线段, 一个点无法构成线段");this.hook=new r.Subscribe,this.points=[e,t],this.mesh=nv(this,"normal"),this.lightMesh=nv(this,"light"),this.distanceItem=rv({line:this,clickCallback:()=>this.hook.emit("selected",this),userDistanceItem:this.model.params.userDistanceItemCreator?this.model.params.userDistanceItemCreator():void 0}),e.lines.push(this),t.lines.push(this)}clear(){this.selected=!1,this.polyline=void 0}getPolyline(){if(this.polyline)return this.polyline;const e=this.model.polylines.find((e=>e.lines.includes(this)));if(this.polyline=e,e)return e;const t=new Ym;return t.push(this),t}findAnotherPoint(e){return this.points.find((({id:t})=>t!==e.id))}toJson(){return{id:this.id,points:this.points.map((({id:e})=>e))}}toCompletelyJson(){return{id:this.id,points:this.points.map((e=>e.toJson()))}}clone(){return new ov(this.points[0].clone(),this.points[1].clone(),this.model)}}function av(e,t){for(let n=0,i=t.length;n<i;n++)if(e===t[n])return t.splice(n,1)[0]}class sv{constructor(e){__publicField(this,"id"),__publicField(this,"lines"),__publicField(this,"position"),__publicField(this,"type","point"),this.id=Xm(),this.lines=[],this.position=new t.Vector3,e instanceof t.Vector3?this.position.copy(e):this.position.fromArray(e)}toJson(){return{id:this.id,lines:this.lines.map((({id:e})=>e)),position:this.position.toArray()}}addLine(e){this.lines.push(e)}removeLine(e){av(e,this.lines)}clone(){return new sv(this.position)}}class lv{constructor(e){__publicField(this,"lines",[]),__publicField(this,"points",[]),__publicField(this,"params"),__publicField(this,"polylines",[]),__publicField(this,"hook",new r.Subscribe),this.params=e}addLine(e){const[t,n]=e.points;if(!t||!n)return this;this.includes(t)||this.points.push(t),this.includes(n)||this.points.push(n),this.lines.push(e);const i=this.polylines.find((t=>!!t.getNext(e)));if(i)i.push(e);else{const t=new Ym;t.push(e),this.polylines.push(t)}this.hook.emit("lineAdded",e)}removeLineByID(e){const t=this.getLineByID(e);t&&this.removeLine(t)}removeLine(e){const t=this.polylines.find((t=>t.lines.includes(e)));if(t){if(t.lines.slice(-1)[0]!==e)throw new Error("不能从中间删除线段");t.pop(),0===t.lines.length&&av(t,this.polylines)}const[n,i]=e.points;return 0===n.lines.length&&av(n,this.points),0===i.lines.length&&av(i,this.points),av(e,this.lines),e.clear(),this.hook.emit("lineRemoved",e),this}mergeModel(e){e.lines.forEach((e=>this.addLine(e)))}includes(e){return"point"===e.type?void 0!==this.points.find((({id:t})=>t===e.id)):"line"===e.type?void 0!==this.lines.find((({id:t})=>t===e.id)):void 0}getPointByID(e){return this.points.find((({id:t})=>t===e))}getLineByID(e){return this.lines.find((({id:t})=>t===e))}getClosestPoint(){}parse(e){const t=e.points.map((({id:e,position:t})=>{const n=new sv(t);return n.id=e,n})),n=e.lines.map((e=>{const[n,i]=e.points,r=this.getPointByID.call({points:t},n),o=this.getPointByID.call({points:t},i);if(!r||!o)throw new Error("线上的点不存在");const a=new ov(r,o,this);return a.id=e.id,a})),i=e.polylines.map((e=>{const t=new Ym;return e.lines.forEach((e=>{const i=n.find((({id:t})=>t===e));i&&t.push(i)})),t}));return this.points.splice(0,this.points.length,...t),this.lines.splice(0,this.lines.length,...n),this.polylines.splice(0,this.polylines.length,...i),this}toJson(){return{points:this.points.map((e=>e.toJson())),lines:this.lines.map((e=>e.toJson())),polylines:this.polylines.map((e=>e.toJson())).filter((e=>e.lines.length>0))}}}const cv=e=>e.preventDefault();class hv{constructor(e){__publicField(this,"five"),__publicField(this,"group"),__publicField(this,"model"),__publicField(this,"disposed",!1),__publicField(this,"mouseGroup"),__publicField(this,"container"),__publicField(this,"fiveHelper"),__publicField(this,"hook"),__publicField(this,"magnifier"),__publicField(this,"userDistanceItemCreator"),__publicField(this,"updateDistanceUI",(()=>{this.model.lines.forEach((e=>e.distanceItem.update(this.five)))})),this.five=e.five,this.hook=e.hook,this.model=e.model,this.magnifier=e.magnifier,this.container=e.container,this.fiveHelper=e.fiveHelper,this.userDistanceItemCreator=e.userDistanceItemCreator,this.group=e.group,this.mouseGroup=e.mouseGroup;const t=this.five.getElement();t&&(t.addEventListener("touchstart",cv),t.addEventListener("contextmenu",cv))}removeLine(e){this.group.remove(e.mesh,e.lightMesh),e.distanceItem.remove(),this.five.needsRender=!0}updateMouseGroup(e,t){if(!e)return this.mouseGroup;const n=this.fiveHelper.getAdsorbentPoint(e),i=n||e.point;if(this.mouseGroup.position.copy(i),t)this.mouseGroup.quaternion.copy(t.quaternion);else if(e.face){const t=e.face.normal.clone().multiplyScalar(.05),n=e.point.clone().add(t).clone().add(t);this.mouseGroup.lookAt(n)}return this.mouseGroup}dispose(){this.disposed=!0,this.magnifier.dispose(),this.model.lines.forEach((e=>this.removeLine(e)));const e=this.five.getElement();e&&(e.removeEventListener("touchstart",cv),e.removeEventListener("contextmenu",cv))}}function uv(e){const{x:n,y:i}=e.center,{clientWidth:r,clientHeight:o}=e.target,a=e.target.getBoundingClientRect(),s=new t.Vector2(n,i).sub(new t.Vector2(a.left,a.top));return{point:s,ndcPoint:new t.Vector2(s.x/r*2-1,-s.y/o*2+1)}}function pv(e,n){const i=uv(n).ndcPoint,r=new t.Raycaster;return r.setFromCamera(i,e.camera),e.model.intersectRaycaster(r)}class dv extends hv{constructor(e){var t;super(e),__publicField(this,"type","edit"),__publicField(this,"model",new lv({userDistanceItemCreator:this.userDistanceItemCreator})),__publicField(this,"pressPoint"),__publicField(this,"hasAppendDashed",!1),__publicField(this,"hasAppendMouseGroup",!1),__publicField(this,"fiveElement"),__publicField(this,"lastPoint",null),__publicField(this,"dashed"),__publicField(this,"hammer"),__publicField(this,"onIntersectionUpdate",En(((e,t)=>{var n;!1===this.hasAppendMouseGroup&&(this.group.add(this.mouseGroup),this.magnifier.appendTo(this.container),this.hasAppendMouseGroup=!0);const i=this.updateMouseGroup(e,t).position;null==(n=this.pressPoint)||n.position.copy(i),this.updateDashed(),requestAnimationFrame((()=>this.magnifier.updateWithPoint(this.mouseGroup.position))),this.five.needsRender=!0}),20)),__publicField(this,"revoke",(()=>{if(0===this.model.lines.length&&this.lastPoint)return this.lastPoint=null,this.hasAppendDashed=!1,this.dashed.distanceItem.remove(),this.group.remove(this.dashed.mesh),this.hook.emit("anchorChange",null),void(this.five.needsRender=!0);if(0===this.model.lines.length&&!this.lastPoint)return;if(!this.lastPoint)return;const e=this.model.lines[this.model.lines.length-1],t=e.findAnotherPoint(this.lastPoint);t&&(this.lastPoint=t,this.hook.emit("anchorChange",t.position),this.group.remove(e.mesh),this.model.removeLine(e),this.hasAppendMouseGroup=!1,this.mouseGroup.position.copy(this.lastPoint.position),this.group.remove(this.mouseGroup),e.distanceItem.remove(),this.updateDashed(),this.magnifier.dispose(),this.five.needsRender=!0)})),__publicField(this,"onMouseLeave",(()=>{this.magnifier.dispose(),this.group.remove(this.mouseGroup),this.hasAppendMouseGroup=!1,this.lastPoint&&(this.mouseGroup.position.copy(this.lastPoint.position),this.updateDashed())})),__publicField(this,"onLineChanged",(()=>{this.hook.emit("editedLineChange",this.model.lines.map((e=>e.toCompletelyJson())))})),__publicField(this,"onPress",(e=>{const[t]=pv(this.five,e);if(!t||!t.face)return;const n=new sv(t.point);this.pressPoint=n,this.onIntersectionUpdate(t)})),__publicField(this,"onPan",(e=>{if(!this.pressPoint)return;const[t]=pv(this.five,e);t&&t.face&&this.onIntersectionUpdate(t)})),__publicField(this,"onPanEnd",(e=>{this.pressPoint&&this.onTap(e)})),__publicField(this,"onTap",(e=>{this.hasAppendDashed||(this.dashed.distanceItem.appendTo(this.container),this.group.add(this.dashed.mesh)),this.hasAppendDashed=!0;const[t]=pv(this.five,e);this.updateMouseGroup(t);const n=new sv(this.mouseGroup.position),i=this.lastPoint;if(n&&(this.lastPoint=n),n&&i){const e=new ov(i,n,this.model);e.distanceItem.appendTo(this.container),this.model.addLine(e),this.group.add(e.mesh),e.distanceItem.update(this.five)}this.pressPoint=void 0,this.hasAppendMouseGroup=!1,this.magnifier.dispose(),this.group.remove(this.mouseGroup),this.updateDashed(),this.five.needsRender=!0,this.hook.emit("anchorChange",n.position)})),__publicField(this,"onWantsTapGesture",(()=>!1)),__publicField(this,"onWantsToMoveToPano",(()=>!1)),__publicField(this,"onWantsPanGesture",(()=>!this.pressPoint&&void 0)),__publicField(this,"onCameraUpdate",(()=>{this.updateDistanceUI(),this.dashed.distanceItem.update(this.five)})),__publicField(this,"updateDashed",(()=>{this.lastPoint&&(this.dashed.points[0].position.copy(this.lastPoint.position),this.dashed.points[1].position.copy(this.mouseGroup.position),this.dashed.mesh.setPoints(this.lastPoint.position,this.mouseGroup.position),this.dashed.distanceItem.update(this.five))})),this.dashed=new ov(new sv([0,0,0]),new sv([0,0,0]),this.model),this.dashed.mesh.setMaterial({dashed:!0,dashScale:100}),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsPanGesture",this.onWantsPanGesture),this.five.on("wantsTapGesture",this.onWantsTapGesture),this.five.on("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.on("intersectionOnModelUpdate",this.onIntersectionUpdate),this.model.hook.on("lineAdded",this.onLineChanged),this.model.hook.on("lineRemoved",this.onLineChanged);const n=this.five.getElement();if(n){this.fiveElement=n;const e=new Wm(n);this.hammer=e,e.on("tap",this.onTap),e.on("pan",this.onPan),e.on("press",this.onPress),e.on("panend",this.onPanEnd)}null==(t=this.fiveElement)||t.addEventListener("mouseleave",this.onMouseLeave),this.hook.emit("anchorChange",null),this.five.refresh()}dispose(){var e,t;super.dispose(),this.group.remove(this.mouseGroup,this.dashed.mesh),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.onWantsPanGesture),this.five.off("wantsTapGesture",this.onWantsTapGesture),this.five.off("wantsToMoveToPano",this.onWantsToMoveToPano),this.five.off("intersectionOnModelUpdate",this.onIntersectionUpdate),this.model.hook.off("lineAdded",this.onLineChanged),this.model.hook.off("lineRemoved",this.onLineChanged),null==(e=this.hammer)||e.destroy(),null==(t=this.fiveElement)||t.removeEventListener("mouseleave",this.onMouseLeave),this.magnifier.dispose(),this.dashed.distanceItem.remove(),this.five.needsRender=!0}getEditingLines(){return this.model.lines}}const fv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABACAYAAADBAT+LAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAiKADAAQAAAABAAAAQAAAAABHi6MyAAAQMUlEQVR4Ae1dTWxV1RampVCwQH+QPhADKbHAy0sgGHkOHejExDhRB8aRA2Mk0cQfGDlzZhwTJzpyYGI0ceBIRxp1ojFE8h4qKE992ActhZYWKa11fbf3O/nu6t53n33PaZVnV3LuWnutb31r7XP2Pefc29t7161bk7U90GYPdLWJ1RJaXFxEjW7Zepq2+mHrBjzHsCGq1SYPNERzNaZ8ilW85qufPBr3fORcNBC338SGT8ewISEsY9DYFmybt23Otl+b23XTM11dXYitmOBg1S7NRbHeiLu//PLLnpdeemno559/3nbt2rU+226bn5/fYJgNprsXFha4Y3P6QA52LHNpQ4fE40MY9aX4FEsbB5L9wMcFBtvXL83f29u7zraFvr6+xYGBgfmRkZG5u+66a/7ee++98eCDD87Zfpw1/mnbrthiwQKqVXRClYibiwJ83cePH+99++2375iYmBiem5vrt0WAncWdgjq0oSF+By55b93H1PxS8VIzX79+/eLBgwevP/DAA9MvvPDCzJ49e65Z4hXbpm2xcN+W4oqBalkgzcXRffjw4e3ffffdiC2K7bIoUDu1AHJ3WFW83x++P8/v8X6cyvdxn+/rZeNtsfx26NChmRdffPHyE088gTPKZdsqLxQ0Ull27ty5Y3x8fNQuGYOVydYIKu8BuwTNnDhx4tJTTz2Fs8m4nU1udEpadYFs2rBhw99v3rx5hzXAZ0GZXoiFhqSeMUuo8o+e32f6elXxns/X82NfLzff8/lxg//o0aOTJ0+eHLvnnnsmDYB7FPizBI11KsM9PT1H7KyBG10/4RSn3yG5+XXz5/aTi/f9Vs33fH5c8OMG9+WXX/6PbeMGmrBFwldIPic4BlEnss+SDtjWab5fEMWEOmmmRE7VelXzfYt183n+ljFuZh999NEL9sJhzAJYJHjJXEpyDzBeuv7Dtt2O3R9gvwMcfNmwar4nrJvP8/tx1XpV80v1Yy8ixj/88MMfd+zYMVn2vgQvP8tKrwH/aZtfHMjnaQtabcRCggUEgQ5tjEF3Ip4fHPR1wpfK0TmrHctjL6G5ayyWn/IrR2GfOnVquy2S0c8///x2e+W5MUWCOFZuGcFCwuIYaIL9ivccaIoYxGizXm7c86f4cvFV+Xy93PlVre/r+X5a+IeHh6dssXxrrz5xJml7uUFiGTlkILxS+aOkZYLWRGqH/FF9rlTd2ud/4MCB8TNnzpyzhq+2u3Etc4kZMZJdzZnjwGCDUKvNuNeKge2FXMxDnD61GfdaMbBzhbXIi3z61C4bJ45aOWB7Ya0Y3seJowYfMZ47OP7mm29uv++++3ZacEvzjc4gLrVAdljW/mZmTgM8M0Hr6ueEvEYJ5adNnI9jrOLxzKMGlhi1O41r7ZB9S8z/s88+2/Pkk08O2QQ2hSYBX7s/1uGmFJeWkOBGDDuBN2TA6AHwY8aoddEAmxJfj7V5IMBLTnDR1jj8rO+1xwPbTnw/wJKTeTqmTV21HvLZA2uTE2Pa0BDWbdH2HtbiW2+9te/hhx+etrPIzdD9CAmWaFofD9vwb62u0iPfoE9Eo8T4GMaMsT+Prxr3NVN8Hp8aez6P9/PxcZ/v8VXjLfV27do1ceHChTPmnLVFglqFxC4xOO10ujhAziLQoU0xsL3wzAStNnGeH3761A7VJo46hFcf7Fwhd9n6nl/nrDZxnh9++tQuVf+XX37Z/vjjj/db4rIrClZiSI6aE394Y9HcFRviVB94yQk/bfaTiisX7Fy8z/fjFF8q7vn8OJWfiufyefyy8bZt26auXr16ygK/6lkkdAbB2QPvd6DJskIsdJkNvMxRm7nqU5txrxWjtseVHSsH7JSAF9Ipv88nV4O0yUtfqAZjZfHLOKamprY+8sgjOO4ta4LPWBJDH7HtdnWYDUI+y12oMWQsxBfCe5/nT/FVxfv6ufVy8z3ej6vOp5b++/v7J69cuXLaziDFxwP8NQdvv+IMAmHTS6P2j8BCqJdGeY+aS5s6xKQx2tQe73cgcPQByzxqxqDLCPOoy+R4jObSpvZYjDVGm9rj/XyAo6/gmpmZGXjzzTc32iuaOV5m/A7YY+hRSfZxkEF8ARaL4ZeyVu8xt7+Vxq/ezJcqdTyfvXv3fn/+/PmfbIE03oJvud4Y97BterBRKLQpRm1i0SZsCu2yceJiGrzkVJt47Qk2hBo2c2N4+MlBjGrGoNUmRmuoXTZOXEwrp9rEa0+wIdSwgYMsw1+6dKnl9kIvMfhT/rZmEpOhQ6IFGKcPY9rU6lM7FgemnTCPGtiQrT7PpzHa1J4vlhvD00/t+ein9nFfz4+ZR+3z6af2+VG8fZ546zvvvNONt99xmdFVtd2y8OZYGdEVGsKjMWIQp816dcd9D76ej/v6Pp4a5/J7vK9fNe779Xw+7uu3xO0zrV/bh8/xWdZFvcRsFRQKQKDVbjjtAQUg0KGNMegy4vmQQ5/arKU+2F6YS7zXwBPjczHWOatNLHM9L8fAEcOcdprYWH4q7rk9nrzUwBPjc9fZZWYLnXqJ2Uynabx7hx3Dd/EQUkLEMObOQ1yFMc0J2fR5vlC+8qfwPq65sD2/x/+l53/9+vXij3e6QG7ze7HNmAeW2kP9Dk8dEB8Hn3Kn+Dze95Pi9/jUmL1Re3yq31QcfMqdi/f9ZM3f7j9uw+UFJLpA8B4IzxhoiM8i4HyBThrWCdOO6RA/+wjpFF5zYHvhXNfmb3vGFkjxcUS9B9HFogdObb9jOx0rp9qd8vk85VTb42JjzVE7hs/1K6fauTwxvHKqHcO3+O1jAHhF2xBdFHgWlhVf1I/BQ1+Ms12cMeoQh8ZoU/v69KvmWQdY2DyLYJwS5QHWj9UX42JOKM4YdTuM1lJ8yKYPut38iwWiZxBtQolg+02bgs3FBa02YmXE10MOfWqzD/WpHYsDkyOsTT6vwUUMbJ2z2oiVEXKxDnLoU7vTeJkeFFPULs4g9l9yC3Zq4eS0KU2M2SBEbkEcA7bxay5taqSFbPpYm/3DT1+sJHOVO+SL5au/TD3Fh+xQ7ZAPufRTc651zb/4zpHGGaT5rlnhdA2wCWrfIP3UiFcVckGrHePlzSW02jF8yq811Wae+tRmvKpWTrVjvDpntWP4lL/4V4jiDGIZ+BNvcfdqNhtLkSEOLFdxGXwKQ666nhGpeqH4X3n+xRfR8B6ka9OmTfhKo5hwZ0FjwyqlrmPF+rq+HuL0eWyZMXOh1S6TC4zmwP5/nz++taghPIMs2j1I4WRQNHYKn9Vw0y77DE/hU3FppWHWjfd8vt5fbf7FyYJnkHX79u3DAsGOCG3YYfBTaBMLP33EqGYshk/FlQt23XjPxz6ptabasTgwKp4fMfrUrotPa5fhZy+sj28oakixQF555ZVpO4soEAAm0G4kBR40T21C1ad2LA5Muw155FGbOeqD7YW5MXwqXjefr8e+Yhr1maM28eqD7YW5ITx8U0xoXGLwvrvJgn3ZyLS91OVfdUkCLG1q5qvWGG1q5VA7FlfeTmzyUoc4NEabWntUW+OeU2O0qZVD7Vjcc+eOyUsdytcYbWgsjuIVbXEGAYN9Sx6+0yokSqB2CAufYtSO4b1fc9QmTm+M1WY8pZVT7VieYtSuC+95tIbaxOmc1WY8pZVTbeRNaLIukAX7PtPLgcsM8LiJg0DrDR3IQxuwLAzbC2OhXPi0htrEg48cnltjdeHRAwQ61A/rUAOb0x/zqLWG2ozn8ufgLwFMQfFC7DLTOzQ0NDo5OYn/slpJwUQ5cdSh3dKPNJCLl9SgWTdfsEgbZ279XHyb0o1QjA9XkH9psp5B4F946KGHLpoGAQRa7YbT+YhRDRzz1CZGF4TajHutGC4i6hC/+tQmr/pgewEOEsP7OHHUzG2QNHnoA8bPR33kUO3x4FqJ+f8XxCpaBJ8DwHizfQPNfvvYWc4HiJRzzb419wBe2n7tW285gzQ/RXTzsccew7fh6QpGHsZ1Cbm0htqoQ0yoJmPM8fhU3HN6PHmpPb/Pzx1XrefzfX+puO8X+B+9E+OWMwgczbNI3+jo6N6zZ8/i3yBWQ9AHmmQ/tDnR3B7q5sutn4uvu99cPrxy+TbUdMsZBIDmWeTX119/fcy+RRl/1eNBog7xVPWRG1rtTnmVQ23yqU/tsnHi6tLag9qd8iuH2uRTH47xeQa8XrZAALBFMn///ffPPvvss2P2sldXI4iVnHzqIyZHg4ccapfl0By1Y/mKUZt4nbPajGuO2oznauVQuyyP5qgdy1fMWRsUf71FQAWTD0rzUrPFvqF3x7vvvjtsIBSL4oMkq+dkb9AQPahLnrzHuvnyquejO+0X9x0X2pVre8BtkeAMM3D33Xfv/Oqrr/AWfAzvG2xXs0zMH+AU/2rj/RxS/Xl8arwa88EbYvgazLYSO+BFki2SHvuVqEH7LZI7fvjhh+IfagrAn8PI3aF/jq7r6yJ3/vjhoX/bxrfpo50E70EUjfuRLVu2TH3wwQcXR0ZG8HtpIcEzCAId2hiDhni8+tQOcWkusBBOFFrtRnAVHrSnUM9ogRi1iVWf2ox7rRjYOme1EfOCxYFXLMT5eMs4eQYh2s4kvfYFI4P2O2lDn3zySfG/m4w7nbuiXfqyewjsIHICS5v9+7jnW+1x1f5S+al4bL74SZDztpVaHCBJnkEAgtiZ5Ib9sN74xx9/PPHMM89ctZfAS4GlRxwgiF/psTGxjaTAAycArTahqXrAEcOcHM1c9p/i83jmxXSKT+esNueQqhfi/8mc39tGPnK11XwGtgVpsHnjuv2NN97of+655/pnZ2exyFIrOhXXErBT+FTc8/lxKj8Vv5X48NkOLIzYRzn8XFrG2BHZYosEeYP2HRIDx44d6/voo49W++YVzyAeRPRPu+x8cvNz8ehpJaVUP/YBsMs3btzAmSP6PkeqydKXGCXCu622Xba34y/YD9RMvv/++1NHjhxBE2gcG4R6adT6yBjxXvt8j9cFwUVBrbnkVV9rJ+VG5IbGBl5q1lANVoxjwpjmqI08YtQmhrXZDzCwG7Jx48Zp+4zxt7Y48DK248UBsoK0wdzBQ/NsgvdIhuyVzubXXnut99NPP+2xHzrkJDpgveVSOFfuTxxI+lZlMrgntH9dmdq/f///vvjiC/xlFk9iXWQd9cEJdZSsSbJQBsfGxvrsS+K733vvvQ3WbHdzsSg8ZfsdzJ0d6zeF93FfP8Xv8Z4vN9/z+XEpflsUi3YZmd29e/fVp59+evL555+/aUSNz5PWsTjQVGyH+4azxrZY8B96+NberfalaJvtZXG3LZSuc+fOdZ0+fbrr4sWL3fa1z+vsBrfLNnD7HQLfSoo/oL5+Kl61t9L8WATY7IDjQ+Xzg4ODc/YT7XN2pph99dVXZ+68804sCLwyWahrUejkVmSBaAFbLPgqAbxvgq+4ws0sNiwgfKIeG3rAxldDvC/yPuJUM0exONjYYdC0zSxs7wcWG0Rj3kZcscxRn+ZoHH6IYjVOO5bPOBYDF0SDayUWRaPTtYe1PVBmD/wO6CvGytWge74AAAAASUVORK5CYII=";class mv{constructor(e,t){__publicField(this,"visible",!1),__publicField(this,"five"),__publicField(this,"lines",[]),__publicField(this,"points",[]),__publicField(this,"onClick"),__publicField(this,"content",document.createElement("div")),__publicField(this,"container",document.createElement("div")),__publicField(this,"onMouseEnter",(()=>{this.content.style.backgroundImage="url(data:image/png;base64,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)"})),__publicField(this,"onMouseLeave",(()=>{this.content.style.backgroundImage=`url(${fv})`})),this.five=e,this.onClick=(null==t?void 0:t.onClick)||(()=>{}),this.container.classList.add("fpm__delete"),this.container.style.opacity="0",this.container.style.position="absolute",this.container.style.left="0",this.container.style.top="0",this.container.style.transform="translate3d(0, 0, 10px)",this.container.style.pointerEvents="none",this.content.classList.add("fpm__delete-content"),this.content.style.width="67px",this.content.style.height="31px",this.content.style.display="flex",this.content.style.alignItems="center",this.content.style.justifyContent="center",this.content.style.transform="translate(-50%, -50%)",this.content.style.color="#fff",this.content.style.fontSize="14px",this.content.style.lineHeight="31px",this.content.style.borderRadius="15px",this.content.style.backgroundSize="100% 100%",this.content.style.cursor="pointer",this.content.style.userSelect="none",this.content.style.backgroundImage=`url(${fv})`,this.content.innerHTML='\n <svg class="fpm__delete-icon" width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="21.443%" y1="100%" x2="67.281%" y2="6.672%" id="a">\n <stop stop-color="#FFFCFC" stop-opacity=".6" offset="0%" />\n <stop stop-color="#FFF" offset="100%" />\n </linearGradient>\n </defs>\n <path\n d="M14.932 3.545a.75.75 0 0 1 .102 1.494l-.102.006H13.83l-.979 8.813a2.05 2.05 0 0 1-1.882 1.818l-.155.006H4.868a2.05 2.05 0 0 1-2.037-1.824l-.98-8.813H.75a.75.75 0 0 1-.102-1.493l.102-.007h14.182zm-2.611 1.5H3.36l.961 8.648a.55.55 0 0 0 .369.46l.087.021.091.008h5.946a.55.55 0 0 0 .546-.49l.961-8.647zM10.795 0a.75.75 0 0 1 .102 1.493l-.102.007H4.886A.75.75 0 0 1 4.785.007L4.886 0h5.91z"\n transform="translate(2.16 2.16)"\n fill="url(#a)"\n fill-rule="nonzero"\n />\n</svg>\n <span>删除</span>\n ',this.container.append(this.content);const n=this.content.querySelector(".fpm__delete-icon");n&&(n.style.width="20px",n.style.height="20px",n.style.marginRight="2px"),this.content.addEventListener("click",this.onClick),this.content.addEventListener("mouseenter",this.onMouseEnter),this.content.addEventListener("mouseleave",this.onMouseLeave)}dispose(){this.content.removeEventListener("click",this.onClick),this.content.removeEventListener("mouseenter",this.onMouseEnter),this.content.removeEventListener("mouseleave",this.onMouseLeave),this.container.remove()}appendTo(e){return e.append(this.container),this}setLines(e){return this.lines=e,this.points=Array.from(new Set(this.lines.map((e=>[e.points[0],e.points[1]])).flat(1))),this}updatePosition(){if(0===this.lines.length)return this;const e=this.points.map((e=>e.position)).map((e=>e.clone().project(this.five.camera)));if(e.some((e=>Math.abs(e.z)>1)))return this.hide();const t=e.map((e=>e.x)),n=e.map((e=>e.y)),i=(Math.min(...t)+Math.max(...t))/2,r=Math.max(...n),o=this.container.parentElement;if(!o)return this;const a=(i+1)/2*o.clientWidth,s=-(r-1)/2*o.clientHeight-34;return this.container.style.transform=`translate3d(${a}px, ${s}px, 10px)`,this.show()}hide(){return this.visible=!1,this.container.style.opacity="0",this.container.style.pointerEvents="none",this}show(){return this.visible=!0,this.container.style.opacity="1",this.container.style.pointerEvents="auto",this}}function vv(e,n,i,r){const o=e.getElement();if(!o)return null;if(0===n.length)return null;const a={width:o.clientWidth,height:o.clientHeight},s=n.map((n=>{const r=n.position.clone().project(e.camera);if(!iv(r))return{distance:1/0,point:n};const o=function(e,n){const i=(e.x+1)/2*n.width,r=-(e.y-1)/2*n.height;return new t.Vector2(i,r)}(r,a);return{distance:o.distanceTo(i),point:n}})).sort(((e,t)=>e.distance-t.distance));return"number"==typeof r&&s[0].distance>r?null:s[0]}function gv(e){const t=(e,n,i)=>{const r=e.lines.find((t=>t.points.findIndex((({id:t})=>t===e.id))!==n));if(!r)return i;const o=r.points[n];return o?t(o,n,i.concat(r)):i},n=t(e.points[0],1,[]),i=t(e.points[0],0,[]);return n.concat(i)}class yv extends hv{constructor(e){super(e),__publicField(this,"type","watch"),__publicField(this,"deleteDom"),__publicField(this,"highlightedLines",[]),__publicField(this,"fiveElement"),__publicField(this,"editPointState"),__publicField(this,"hammer"),__publicField(this,"onPanStart",(e=>{var t;if(0===this.model.points.length||!this.fiveElement)return;const n=uv(e).point,i=null==(t=vv(this.five,this.model.points,n,20))?void 0:t.point;if(!i)return void(this.editPointState=void 0);const r={point:i,associatedLines:gv(i.lines[0])};this.hook.emit("wantsDragLine",{point:i.id,lines:r.associatedLines.map((({id:e})=>e))})||(this.editPointState=r,this.magnifier.appendTo(this.container),this.group.add(this.mouseGroup))})),__publicField(this,"onPanEnd",(()=>{this.editPointState&&(this.editPointState.point.lines.forEach((e=>e.mesh.setMaterial({dashed:!1}))),this.highlightLines(this.editPointState.associatedLines),this.editPointState=void 0,this.magnifier.dispose(),this.group.remove(this.mouseGroup))})),__publicField(this,"onPan",(e=>{if(!this.editPointState||!this.fiveElement)return;const n=uv(e).ndcPoint,i=new t.Raycaster;i.setFromCamera(n,this.five.camera);const[r]=this.five.model.intersectRaycaster(i);r&&this.onIntersectionUpdate(r)})),__publicField(this,"onIntersectionUpdate",((e,t)=>{if(this.editPointState){if(this.clearHighlightLines(),this.editPointState.point.position.copy(e.point),this.editPointState.point.lines.forEach((e=>{e.mesh.setPoints(e.points[0].position.clone(),e.points[1].position.clone()),e.lightMesh.setPoints(e.points[0].position.clone(),e.points[1].position.clone()),e.mesh.setMaterial({dashed:!0})})),this.updateDistanceUI(),this.magnifier.updateWithPoint(e.point),this.mouseGroup.position.copy(e.point),t)this.mouseGroup.quaternion.copy(t.quaternion);else if(e.face){const t=e.face.normal.clone().multiplyScalar(.05),n=e.point.clone().add(t).clone().add(t);this.mouseGroup.lookAt(n)}this.five.needsRender=!0,this.hook.emit("selectedChange",this.editPointState.associatedLines.map((e=>e.toCompletelyJson())))}})),__publicField(this,"wantsPanGesture",(()=>{if(this.editPointState)return!1})),__publicField(this,"wantsTapGesture",(e=>{const[n]=this.five.model.intersectRaycaster(e);if(!n)return;const i=this.five.camera,r=n.point.clone().project(i),o=this.container.clientWidth,a=this.container.clientHeight,s=new t.Vector2(r.x*o,r.y*a),l=this.model.lines.map((e=>{const[n,r]=e.points,s=n.position.clone().project(i),l=r.position.clone().project(i);if(!iv(s)&&!iv(l))return null;const c=new t.Vector2(s.x*o,s.y*a),h=new t.Vector2(l.x*o,l.y*a);return{id:e.id,points:[c,h]}})).filter((e=>!!e));if(0===l.length)return;const c=l.map((e=>{const n=function(e,n){const i=e.x-n[0].x,r=e.y-n[0].y,o=n[1].x-n[0].x,a=n[1].y-n[0].y,s=(i*o+r*a)/(o*o+a*a);let l,c;var h,u;return s<0||(h=n[0],u=n[1],h.x===u.x&&h.y===u.y)?(l=n[0].x,c=n[0].y):s>1?(l=n[1].x,c=n[1].y):(l=n[0].x+s*o,c=n[0].y+s*a),new t.Vector2(l,c)}(s,e.points);return{id:e.id,distance:n.distanceTo(s)}})).sort(((e,t)=>e.distance-t.distance)),h=c[0];if(h.distance>20)return;const u=this.model.lines.find((({id:e})=>e===h.id));return u?(this.chooseLine(u),!1):void 0})),__publicField(this,"chooseLine",(e=>{const t=gv(e);this.highlightLines(t),this.five.needsRender=!0,this.hook.emit("selectedChange",t.map((e=>e.toCompletelyJson())))})),__publicField(this,"lineRemoved",(e=>{this.removeLine(e),this.hook.emit("selectedChange",this.model.lines.filter((e=>e.selected)).map((e=>e.toCompletelyJson())))})),__publicField(this,"onCameraUpdate",(()=>{this.updateDistanceUI(),this.highlightedLines.length>0&&this.deleteDom.updatePosition()})),__publicField(this,"deleteDomClickCallback",(()=>{this.highlightedLines[0].getPolyline().lines.slice().reverse().forEach((e=>this.model.removeLine(e))),this.highlightedLines=[],this.deleteDom.setLines([]).hide()})),this.deleteDom=new mv(this.five,{onClick:this.deleteDomClickCallback}).appendTo(this.container),this.model.lines.forEach((e=>{e.distanceItem.appendTo(this.container),e.distanceItem.update(this.five),e.hook.on("selected",this.chooseLine),this.group.add(e.mesh)}));const n=this.five.getElement();if(n){this.fiveElement=n;const e=new Wm(n);this.hammer=e,e.on("pan",this.onPan),e.on("panstart",this.onPanStart),e.on("panend",this.onPanEnd)}this.model.hook.on("lineRemoved",this.lineRemoved),this.five.on("cameraUpdate",this.onCameraUpdate),this.five.on("wantsTapGesture",this.wantsTapGesture),this.five.on("wantsPanGesture",this.wantsPanGesture),this.five.needsRender=!0}dispose(){var e;super.dispose(),this.deleteDom.dispose(),this.model.hook.off("lineRemoved",this.lineRemoved),this.five.off("cameraUpdate",this.onCameraUpdate),this.five.off("wantsPanGesture",this.wantsPanGesture),this.five.off("wantsTapGesture",this.wantsTapGesture),this.five.needsRender=!0,this.hook.emit("selectedChange",[]),null==(e=this.hammer)||e.destroy()}highlightLine(e){e.selected||(e.selected=!0,this.group.add(e.lightMesh),e.distanceItem.highlight(),this.five.needsRender=!0)}clearHighlightLines(){0!==this.group.children.length&&(this.deleteDom.setLines([]).hide(),this.model.lines.forEach((e=>{e.selected=!1,e.distanceItem.unHighlight(),this.group.remove(e.lightMesh)})),this.highlightedLines=[],this.five.needsRender=!0)}highlightLines(e){this.clearHighlightLines(),this.highlightedLines=e,this.deleteDom.setLines(e).updatePosition().show(),e.forEach((e=>this.highlightLine(e)))}}function xv(){const e=new t.Group,n=new t.PlaneGeometry(.3,.3),i=(new t.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAAI6CAMAAAAZlhLyAAACB1BMVEUAAAD+/v6qqqqgoKCLi4t7e3u4uLhvb29MTExZWVlCQkJgYGBqamo4ODi9vb3///9FRUXPz887Ozv///9QUFBWVlZdXV38/Pzj4+Pn5+f8/Pz5+fn9/f329vZoaGje3t78/Pz////x8fH8/Pzs7OyBgYHd3d39/f319fX+/v79/f2Kior6+vr////+/v76+vr+/v7////8/Pz9/f3+/v7m5ub7+/v+/v7+/v7j4+P////+/v79/f3d3d3h4eH4+Pj+/v79/f12dnbc3Nz9/f3w8PD9/f34+Pj9/f3+/v5jY2P8/Pz9/f2ioqJubm7v7+/+/v76+vr5+fnv7+/09PSDg4P////t7e3+/v7+/v7+/v7///+ZmZl7e3v7+/vy8vL+/v7+/v7p6en19fX////s7Oz+/v6lpaX+/v7r6+vg4OD9/f3q6ur///////+UlJTt7e329vbz8/Pg4OD///+wsLCdnZ2QkJDe3t77+/vz8/Pw8PD+/v7c3Nyqqqrw8PD4+Pj+/v7////4+Pj////s7Oyurq7f39/p6en8/Pz////8/Pz19fVycnK0tLT////q6ure3t7o6Oj////s7Oz39/fd3d3h4eH+/v7j4+P////+/v7n5+f///////////////+ysrLe3t7////////8/PzHx8fl5eX////39/fv7+/d3d3///8S/hbOAAAArHRSTlMAzhATFhkNGyEfIx4dJQ/OKwoozS4wMh3Uy4SPbjs34kJ9EAkGP+8Snk1nRRo5JYl2eDQiA88wY3PXRDYN6dyTX0s751SxPJdhPjRdV1M4ti0XFa+pQiq5aShQSE09IKJwWMilWr9SVzLC3wvFwplKvKKY9spfUEjge6yqnexaLpqQakgBtVz1wQe9i4s6ZaG788fGKIXx95TZzKbSuKu1s2LlsJb7dqiu/cSWYhzVwQAALl1JREFUeNrs0jFqalEUheE9C9ugAQloCg0WmuIJIbxHUsQUQhQEQUTINNI463fvqU2xT3G5xfetNYQ/+M3PT7SDfDo/T0/SIe+pCJAOt0mHvrgvAqRDUn061/vrNSDrOhqNpEOFURGQNfqWDlW+i4CadJ6lQ95zESAdbpMOfTEcPg+Hw4CsphvpUGM4bsoZB2SNW9JB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");i.encoding=t.sRGBEncoding;const r=new t.MeshBasicMaterial({map:i,transparent:!0,depthTest:!1}),o=new t.Mesh(n,r),a=new t.CurvePath;a.add(new t.LineCurve3(new t.Vector3(0,0,0),new t.Vector3(0,0,.1)));const s=new t.TubeGeometry(a,10,.005),l=new t.MeshBasicMaterial({color:3404271,depthTest:!1,side:t.DoubleSide}),c=new t.Mesh(s,l),h=new t.SphereGeometry(.01,32,32),u=new t.Mesh(h,l);return u.position.set(0,0,.1),e.name="mouse-current",e.add(o,c,u),e}const bv="M31.379 15.466a1.045 1.045 0 0 1-.92 1.076l-11.276.607a1.6 1.6 0 0 0-1.512 1.511l-.599 11.113a1.045 1.045 0 0 1-.92 1.075l-.164.008a1.183 1.183 0 0 1-1.123-.975l-.016-.164-.221-10.768a1.6 1.6 0 0 0-1.567-1.567l-11.3-.231-.165-.016a1.187 1.187 0 0 1-.964-.996l-.01-.127.007-.164c.061-.496.455-.876.958-.917l.118-.003 11.112-.599a1.6 1.6 0 0 0 1.498-1.37l.014-.142.607-11.276a1.045 1.045 0 0 1 1.076-.92c.573.015 1.055.46 1.13 1.019l.009.121.221 10.766a1.6 1.6 0 0 0 1.567 1.566l11.3.234a1.181 1.181 0 0 1 1.14 1.139z",wv="url(#fpm__main-c)";var _v=`\n <style>\n .fpm__revoke {\n opacity: 0.3;\n }\n \n .fpm__revoke.enabled {\n opacity: 0.7;\n }\n \n .fpm__revoke.enabled:hover {\n opacity: 1;\n }\n \n .fpm__revoke-icon {\n width: 40px;\n height: 40px;\n margin-top: 10px;\n cursor: pointer;\n } \n </style>\n <div class="fpm_ui-bg"></div>\n <div class="fpm_operating-space">\n <div class="fpm__ui-item fpm__revoke">\n \n <svg class="fpm__revoke-icon" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="47.631%" y1="55.183%" x2="2.967%" y2="86.323%" id="fpm__revoke-a">\n <stop stop-color="#FFF" offset="0%" />\n <stop stop-color="#FFF" stop-opacity=".5" offset="100%" />\n </linearGradient>\n <linearGradient x1="5.297%" y1="43.016%" x2="38.238%" y2="79.932%" id="fpm__revoke-b">\n <stop stop-color="#FFF" offset="0%" />\n <stop stop-color="#FFF" stop-opacity="0" offset="100%" />\n </linearGradient>\n </defs>\n <path\n d="M13.388 7.108c.552 0 1.005.42 1.06.957l.006.11v1.224c0 .921.745 1.667 1.666 1.667h7.184c5.804 0 10.509 4.616 10.509 10.309 0 5.595-4.544 10.15-10.21 10.305l-.3.004H8.924c-.917 0-1.66-.729-1.66-1.628 0-.846.658-1.541 1.5-1.62l.16-.008h14.38c3.972 0 7.191-3.158 7.191-7.053 0-3.81-3.08-6.916-6.933-7.049l-.257-.004H10.029l-.109-.005H8.212c-.245 0-.482-.085-.67-.237l-.09-.082a1.066 1.066 0 0 1-.065-1.422l.079-.086 5.175-5.077c.2-.195.468-.305.747-.305z"\n fill="url(#fpm__revoke-a)"\n fill-rule="nonzero"\n stroke="url(#fpm__revoke-b)"\n stroke-width=".5"\n />\n </svg>\n\n <span class="fpm__text fpm__revoke-text">撤销</span>\n </div>\n <div class="fpm__ui-item fpm__main">\n ${`\n <svg class="fpm__main-icon" width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <mask id="fpm__main-icon-mask">\n <rect id="fpm__main-icon-mask-black" x="0" y="0" width="30" height="30" fill="black"></rect>\n <rect id="fpm__main-icon-mask-white" x="0" y="0" width="0" height="30" fill="white"></rect>\n </mask>\n <linearGradient id="fpm__main-a" x1="25.371%" y1="0%" x2="109.587%" y2="172.268%">\n <stop stop-color="#FFF" offset="0%" />\n <stop stop-color="#FFF" stop-opacity=".77" offset="44.051%" />\n <stop stop-color="#FFF" stop-opacity=".201" offset="100%" />\n </linearGradient>\n <radialGradient id="fpm__main-b" fx="50%" fy="50%" r="50.864%" gradientTransform="matrix(-.98302 0 0 -1 .992 1)">\n <stop stop-color="#2D7CFF" offset="0%" />\n <stop stop-color="#2D7CFF" stop-opacity=".3" offset="100%" />\n </radialGradient>\n <radialGradient id="fpm__main-c" fx="50%" fy="50%" r="50.864%" gradientTransform="matrix(-.98302 0 0 -1 .992 1)">\n <stop stop-opacity=".4" offset="0%" />\n <stop stop-opacity=".12" offset="100%" />\n </radialGradient>\n </defs>\n <g fill="none" fill-rule="evenodd">\n <circle fill="url(#fpm__main-a)" cx="30" cy="30" r="30" />\n <path\n class="fpm__main-icon-path"\n d="${bv}"\n fill="url(#fpm__main-c)"\n fill-rule="nonzero"\n transform="translate(14 14)"\n />\n </g>\n </svg>\n`}\n <span class="fpm__text fpm__main-text">添加</span>\n </div>\n <div class="fpm__ui-item fpm__exit">\n \n <svg class="fpm__exit-icon width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="36.288%" y1="73.736%" x2="54.242%" y2="97.166%" id="fpm__exit-a">\n <stop stop-color="#FFF" offset="0%" />\n <stop stop-color="#FFF" stop-opacity=".5" offset="100%" />\n </linearGradient>\n <linearGradient x1="100%" y1="47.234%" x2="24.047%" y2="47.234%" id="fpm__exit-b">\n <stop stop-color="#FFF" offset="0%" />\n <stop stop-color="#FFF" stop-opacity=".005" offset="99.535%" />\n <stop stop-color="#FFF" stop-opacity="0" offset="100%" />\n </linearGradient>\n </defs>\n <path\n d="M22 7a1.5 1.5 0 0 1 .144 2.993L22 10h-9a1.5 1.5 0 0 0-1.493 1.356l-.007.144v17a1.5 1.5 0 0 0 1.356 1.493L13 30h9a1.5 1.5 0 0 1 .144 2.993L22 33h-9a4.5 4.5 0 0 1-4.495-4.288L8.5 28.5v-17a4.5 4.5 0 0 1 4.288-4.495L13 7h9zm6.317 7.755a1 1 0 0 1 .7.286l4.856 4.764a1 1 0 0 1-.7 1.713h-5.856V21.5h-8.032a1.5 1.5 0 1 1 0-3h6.365c.92 0 1.666-.746 1.667-1.667v-1.078a1 1 0 0 1 1-1z"\n fill="url(#fpm__exit-a)"\n fill-rule="nonzero"\n stroke="url(#fpm__exit-b)"\n stroke-width=".5"\n />\n </svg>\n\n <span class="fpm__text fpm__exit-text">退出</span>\n </div>\n </div>\n`;const Mv={position:"absolute",top:"0",left:"0",width:"100%",height:"100%",opacity:"0",transform:"translate(0, 10px)",transition:"opacity 500ms ease-in-out, transform 500ms ease-in-out"},Ev={position:"absolute",left:"50%",bottom:"32px",transform:"translateX(-50%)",width:"300px",height:"89px",display:"flex",justifyContent:"space-between",fontSize:"16px",pointerEvents:"all",color:"#fff",zIndex:"10"},Sv={height:"100%",width:"max-content",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},Av={position:"absolute",bottom:"0",left:"0",opacity:"0.5",width:"100%",height:"184px",background:"linear-gradient(180deg, rgba(0,0,0,0.00) 0%, #000000 100%)",zIndex:"0"},Tv={margin:"0 80px",opacity:"0.7"},Pv={opacity:"0.7"},Lv={width:"60px",height:"60px",backgroundSize:"100%",cursor:"pointer"},Cv={width:"40px",height:"40px",marginTop:"10px",backgroundSize:"100%",cursor:"pointer"},Iv={cursor:"default",userSelect:"none"};class Rv{constructor(e,t){__publicField(this,"container"),__publicField(this,"measureController"),__publicField(this,"mainIconMaskTween"),__publicField(this,"mainElement"),__publicField(this,"onMouseEnter",(()=>{const{mainItem:e,pathDom:t}=this.mainElement;e.style.opacity="1",t.setAttribute("fill","url(#fpm__main-b)")})),__publicField(this,"onMouseLeave",(()=>{const{mainItem:e,pathDom:t}=this.mainElement;e.style.opacity="0.7",t.setAttribute("fill",wv)})),__publicField(this,"onClick",(()=>{"Watch"===this.measureController.getCurrentMode()?this.measureController.changeMode("Edit"):this.measureController.save().changeMode("Watch")})),__publicField(this,"editedLineChangeHandler",(e=>{if(!(e.length>1))return 0===e.length?this.change2Cancel(!1):void this.change2Done()})),__publicField(this,"modeChangeHandler",(e=>{"Watch"===e?this.change2Add():this.change2Cancel()})),this.measureController=e,this.container=t,this.mainElement=this.getMainElement(),Object.assign(this.mainElement.mainIcon.style,Lv),Object.assign(this.mainElement.mainItem.style,Tv),this.change2Add(),this.measureController.hook.on("modeChange",this.modeChangeHandler),this.mainElement.mainIcon.addEventListener("click",this.onClick),this.mainElement.mainIcon.addEventListener("mouseenter",this.onMouseEnter),this.mainElement.mainIcon.addEventListener("mouseleave",this.onMouseLeave)}dispose(){this.measureController.hook.off("modeChange",this.modeChangeHandler),this.measureController.hook.off("editedLineChange",this.editedLineChangeHandler),this.mainElement.mainIcon.removeEventListener("click",this.onClick),this.mainElement.mainIcon.removeEventListener("mouseenter",this.onMouseEnter),this.mainElement.mainIcon.removeEventListener("mouseleave",this.onMouseLeave)}getMainElement(){const e=this.container.querySelector(".fpm__main-text"),t=this.container.querySelector(".fpm__main"),n=this.container.querySelector(".fpm__main-icon"),i=null==t?void 0:t.querySelector(".fpm__main-icon-path"),r=null==n?void 0:n.querySelector("#fpm__main-icon-mask-white");if(!(t&&e&&n&&i&&r))throw new Error("cannot find dom");return{mainTextDom:e,mainItem:t,mainIcon:n,pathDom:i,maskWhiteRect:r}}change2Add(){this.measureController.hook.off("editedLineChange",this.editedLineChangeHandler);const{mainIcon:e,mainTextDom:t,pathDom:n}=this.mainElement;e.style.transition="完成"===t.innerText?"none":"transform 300ms ease-in-out",e.style.transform="rotate(0deg)",t.innerText="添加",null==n||n.setAttribute("d",bv)}change2Cancel(e=!0){const{mainIcon:t,mainTextDom:n,pathDom:i}=this.mainElement;i.setAttribute("d",bv),i.setAttribute("mask",""),t.style.transition=e?"transform 300ms ease-in-out":"none",t.style.transform="rotate(45deg)",n&&(n.innerText="取消"),this.measureController.hook.on("editedLineChange",this.editedLineChangeHandler)}change2Done(){var e;const{mainTextDom:t,mainIcon:n,pathDom:i,maskWhiteRect:r}=this.getMainElement();"完成"!==t.innerText&&(n.style.transition="none",n.style.transform="rotate(0deg)",t.innerText="完成",i.setAttribute("d","M27.1772552,8.15828895 C27.8664561,7.48070421 28.5574369,7.81156875 28.8336646,8.04968716 C29.1098924,8.28780557 29.3990219,9.110014 28.8256559,9.79263351 L28.7110903,9.9165024 L13.9697229,25.1399531 C13.3288458,25.7700285 12.3239388,25.8070917 11.6402346,25.2511429 L11.5159715,25.1399531 L3.7056151,18.0063788 C3.01641417,17.3287941 3.00699739,16.2207954 3.68458213,15.5315945 C4.32230894,14.8829348 5.3413021,14.8364368 6.03356826,15.3981178 L6.15936649,15.5105615 L12.6856594,21.9049888 L27.1772552,8.15828895 Z"),i.setAttribute("mask","url(#fpm__main-icon-mask)"),null==(e=this.mainIconMaskTween)||e.dispose(),this.mainIconMaskTween=Bm().easing(mm.Easing.Quartic.InOut).onUpdate((({progress:e})=>{r.setAttribute("width",(30*e).toString())})).onComplete((()=>{var e;return null==(e=this.mainIconMaskTween)?void 0:e.dispose()})).play())}}class Ov{constructor(e,t){__publicField(this,"container"),__publicField(this,"revokeIcon"),__publicField(this,"revokeItem"),__publicField(this,"measureController"),__publicField(this,"onClick",(()=>{this.measureController.revoke()})),__publicField(this,"onModeChange",(e=>{"Edit"===e?this.revokeItem.classList.add("enabled"):this.revokeItem.classList.remove("enabled")})),__publicField(this,"handleRevoke",(()=>()=>{})),this.measureController=e,this.container=t;const n=this.container.querySelector(".fpm__revoke-icon"),i=this.container.querySelector(".fpm__revoke");if(!n||!i)throw new Error("不正确的选择器");this.revokeIcon=n,this.revokeItem=i,this.revokeIcon.addEventListener("click",this.onClick),e.hook.on("modeChange",this.onModeChange)}dispose(){this.revokeIcon.removeEventListener("click",this.onClick),this.measureController.hook.off("modeChange",this.onModeChange)}}class Dv{constructor(e,t){__publicField(this,"revoke"),__publicField(this,"container"),__publicField(this,"mainController"),__publicField(this,"disposers",[]),__publicField(this,"measureController"),__publicField(this,"handleExit",(()=>{const e=this.container.querySelector(".fpm__exit-icon"),t=this.container.querySelector(".fpm__exit");if(!t||!e)throw new Error("cannot find dom");Object.assign(t.style,Pv),Object.assign(null==e?void 0:e.style,Cv);const n=()=>t.style.opacity="1",i=()=>t.style.opacity="0.7",r=()=>{this.measureController.disable()};return e.addEventListener("click",r),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",i),()=>{e.removeEventListener("click",r),e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",i)}})),this.measureController=e,this.container=document.createElement("div"),this.container.innerHTML=_v,this.container.classList.add("fpm__ui-controller"),t.container.appendChild(this.container);const n=this.container.querySelectorAll(".fpm__text"),i=this.container.querySelectorAll(".fpm__ui-item"),r=this.container.querySelector(".fpm_ui-bg"),o=this.container.querySelector(".fpm_operating-space");Object.assign(null==r?void 0:r.style,Av),Object.assign(null==o?void 0:o.style,Ev),Object.assign(this.container.style,Mv),i.forEach((e=>Object.assign(e.style,Sv))),n.forEach((e=>Object.assign(e.style,Iv)))}dispose(){this.hide(),this.container.remove()}show(){return this.container.style.opacity="1",this.container.style.transform="translate(0, 0)",this.revoke=new Ov(this.measureController,this.container),this.mainController=new Rv(this.measureController,this.container),this.disposers.push(this.handleExit()),this}hide(){var e,t;return this.container.style.opacity="0",this.container.style.transform="translate(0, 10px)",null==(e=this.revoke)||e.dispose(),null==(t=this.mainController)||t.dispose(),this.disposers.forEach((e=>e())),this.disposers=[],this}}class Nv{constructor(e,t){__publicField(this,"measureController"),__publicField(this,"textDom",document.createElement("span")),__publicField(this,"container",document.createElement("div")),__publicField(this,"hasAnchor",!1),__publicField(this,"onModelChange",(e=>{this.textDom.innerText="Watch"!==e?"请选择第一个测量点,Esc或单击鼠标右键可取消选择":""})),__publicField(this,"anchorChange",(e=>{!this.hasAnchor&&e?(this.hasAnchor=!0,this.textDom.innerText="选择下一个测量点,Esc或单击鼠标右键取消选择"):e||(this.hasAnchor=!1,this.textDom.innerText="请选择第一个测量点,Esc或单击鼠标右键可取消选择")})),__publicField(this,"onEditedLineChange",(e=>{1===e.length&&(this.textDom.innerText="可以连续选择测量点,或点击下方“完成”结束测量(Esc取消,Command+S保存)")})),this.initDom(),t.container.append(this.container),this.measureController=e,e.hook.on("modeChange",this.onModelChange),e.hook.on("anchorChange",this.anchorChange),e.hook.on("editedLineChange",this.onEditedLineChange)}dispose(){this.hide(),this.container.remove()}show(){return this.container.style.opacity="1",this.container.style.transform="translate(0, 0)",this}hide(){return this.container.style.opacity="0",this.container.style.transform="translate(0, -10px)",this.measureController.hook.off("modeChange",this.onModelChange),this.measureController.hook.off("anchorChange",this.anchorChange),this.measureController.hook.off("editedLineChange",this.onEditedLineChange),this}initDom(){const e=this.container,t=this.textDom;e.classList.add("fpm__guide-container"),e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.width="100%",e.style.height="110px",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.transform="translate(0, -10px)",e.style.background="linear-gradient(180deg, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.00) 100%)",e.style.transition="opacity 500ms ease-in-out, transform 500ms ease-in-out",e.style.opacity="0",t.classList.add("fpm__guide-text"),t.style.color="#fff",t.style.fontSize="20px",t.innerText="点击下方“添加”开始测距",e.appendChild(t)}}class Fv{constructor(e,t){__publicField(this,"five"),__publicField(this,"measureController"),__publicField(this,"onKeyDown",(e=>e.metaKey&&"KeyS"===e.code?(this.measureController.save().changeMode("Watch"),void e.preventDefault()):"Escape"===e.code?this.escape():void 0)),__publicField(this,"onMouseDown",(e=>{2===e.button&&(e.preventDefault(),this.escape())})),this.five=t,this.measureController=e;const n=this.five.getElement();n&&(document.body.addEventListener("keydown",this.onKeyDown),n.addEventListener("mousedown",this.onMouseDown))}dispose(){const e=this.five.getElement();e&&(document.body.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("mousedown",this.onMouseDown))}escape(){return"Watch"===this.measureController.getCurrentMode()?this.measureController.disable():this.measureController.changeMode("Watch")}}class zv{constructor(e,n){__publicField(this,"hasOpen",!1),__publicField(this,"hook",new r.Subscribe),__publicField(this,"five"),__publicField(this,"model"),__publicField(this,"group"),__publicField(this,"magnifier"),__publicField(this,"fiveHelper"),__publicField(this,"useUIController"),__publicField(this,"params"),__publicField(this,"useGuideController"),__publicField(this,"container",document.createElement("div")),__publicField(this,"shortcutKeyController"),__publicField(this,"controller",null),__publicField(this,"controllerParams"),__publicField(this,"getCurrentMode",(()=>this.controller instanceof dv?"Edit":this.controller instanceof yv?"Watch":null)),__publicField(this,"changeMode",(e=>{var t;if(!this.hasOpen)return;if(this.getCurrentMode()===e)return;null==(t=this.controller)||t.dispose();const n={Watch:yv,Edit:dv};if(!n[e])throw new Error("不存在的 Mode");this.controller=new n[e](this.controllerParams),this.hook.emit("modeChange",e)})),this.five=e,this.params=n,this.model=new lv({userDistanceItemCreator:this.params.userDistanceItemCreator}),this.fiveHelper=new Gm(e);this.magnifier=new Um(e,{scale:2,width:190,height:190}),this.group=new t.Group,this.group.name="plugin-measure-group",this.container.classList.add("five-plugin-measure-container"),this.container.style.position="relative",this.container.style.pointerEvents="none",this.container.style.width="100%",this.container.style.height="100%",this.container.style.background="rgba(0, 0, 0, 0.15)",this.controllerParams={five:this.five,hook:this.hook,group:this.group,model:this.model,magnifier:this.magnifier,container:this.container,fiveHelper:this.fiveHelper,mouseGroup:xv(),userDistanceItemCreator:this.params.userDistanceItemCreator},!1!==this.params.useUIController&&(this.useUIController=new Dv(this,this.controllerParams)),!1!==this.params.useUIController&&(this.useGuideController=new Nv(this,this.controllerParams))}appendTo(e){e.append(this.container)}dispose(){var e,t;this.disable(),null==(e=this.useUIController)||e.dispose(),null==(t=this.magnifier)||t.dispose(),this.five.needsRender=!0}load(e){this.model.parse(e),this.save()}enable(){var e,t;this.hasOpen||(this.hasOpen=!0,this.five.scene.add(this.group),this.five.helperVisible=!1,this.controller=new yv(this.controllerParams),null==(e=this.useUIController)||e.show(),null==(t=this.useGuideController)||t.show(),this.shortcutKeyController=new Fv(this,this.five),this.hook.emit("enable",!0))}disable(){var e,t,n,i;this.hasOpen=!1,null==(e=this.controller)||e.dispose(),null==(t=this.useUIController)||t.hide(),null==(n=this.useGuideController)||n.hide(),null==(i=this.shortcutKeyController)||i.dispose(),this.controller=null,this.five.helperVisible=!0,this.five.scene.remove(this.group),this.five.needsRender=!0,this.hook.emit("disable",!0)}revoke(){this.controller instanceof dv&&this.controller.revoke()}removeLineByID(e){this.model.removeLineByID(e)}highlightLine(e){if("Watch"!==this.getCurrentMode())return!1;const t=this.model.getLineByID(e);return!!t&&(this.controller.highlightLine(t),!0)}clearHighlightLines(){return"Watch"===this.getCurrentMode()&&(this.controller.clearHighlightLines(),!0)}save(){return this.controller instanceof dv?(this.model.mergeModel(this.controller.model),this):this}toJson(){return this.model.toJson()}}e.CSS3DRenderPlugin=c,e.CameraMovementPlugin=e=>{const t={};return{move:async(n,i,r={preload:!0})=>(t.interruptCallback&&t.interruptCallback(!1),r.asyncStartCallback&&await r.asyncStartCallback(),n.mode&&n.mode!==e.currentMode&&await e.changeMode(n.mode),r.preload&&void 0!==n.panoIndex&&n.panoIndex!==e.panoIndex&&await e.preloadPano(n.panoIndex),r.asyncEndCallback&&await r.asyncEndCallback(),void 0===n.panoIndex&&void 0===n.fov&&void 0===n.latitude&&void 0===n.longitude||await new Promise(((t,r)=>{const o=void 0!==n.panoIndex?n.panoIndex:e.panoIndex;void 0!==o?e.moveToPano(o,Object.assign({duration:i,moveEndCallback:()=>t(!0),moveCancelCallback:()=>r(!1)},n)):r(!1)}))),rotate:async(n,i,o={})=>{t.interruptCallback&&t.interruptCallback(!1),o.asyncStartCallback&&await o.asyncStartCallback(),e.currentMode!==r.Five.Mode.Panorama&&await e.changeMode(r.Five.Mode.Panorama),void 0!==n.panoIndex&&n.panoIndex!==e.panoIndex&&(o.preload&&await e.preloadPano(n.panoIndex),await new Promise(((t,i)=>{n.panoIndex?e.moveToPano(n.panoIndex,{moveEndCallback:()=>t(!0),moveCancelCallback:()=>i(!1)}):t(!0)}))),o.asyncEndCallback&&await o.asyncEndCallback();const{from:a,to:s}=(t=>{const n=e.state,i=Sm(n.latitude),r=Sm(t.latitude),{from:o,to:a}=Tm(n.longitude,t.longitude,t.rotation||_m.Loop);return{from:{latitude:i,longitude:o,fov:n.fov},to:{latitude:r,longitude:a,fov:t.fov}}})(n);return await new Promise((r=>{const o=function(e,t){return wm({progress:0},{progress:1},e,t)}(n.rotateSpeed?Math.ceil(Math.abs(s.longitude-a.longitude)/n.rotateSpeed*1e3):i,tm.Linear.None).onUpdate((({progress:t})=>{const n={};n.longitude=Am(a.longitude,s.longitude,t),n.latitude=Am(a.latitude,s.latitude,t),n.fov=Am(a.fov,s.fov,t),e.setState(n,!0)})).onComplete((()=>{r(!0)})).onDestroy((()=>{r(!1)}));n.rotation===_m.Loop&&o.repeat(1/0).yoyo(!0),t.interruptCallback=(e=!0)=>{o.destroy(),t.interruptCallback=void 0,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=void 0),r(e)},t.timeoutId=setTimeout((()=>{t.interruptCallback&&t.interruptCallback(!0)}),i)}))}}},e.FLOOR_PLAN_ATTACHED_TO=ke,e.ModelChassisCompassPlugin=(e,t)=>{const n=t.fbx_url||"//vrlab-static.ljcdn.com/release/web/v3/dipan3/dipan.FBX",i=t.north_rad||void 0,r={},o=({latitude:e})=>{if(!r.object)return;const t=s(e);t&&(r.object.position.y=t)},s=e=>{if(void 0===r.yBase)return;if(e>=Math.PI/4)return r.yBase-2.2;const t=e*(4/Math.PI);return r.yBase-(.6*t+1.6)};return{load:async t=>{const o=(null==t?void 0:t.fbx_url)||n,s=(null==t?void 0:t.north_rad)||i;if(!s)throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const l=e.model.bounding,c=l.max.x-l.min.x,h=l.max.z-l.min.z,u=Math.max(c,h),p=new Zf,d=await p.loadAsync(o);Kf(d,{transparent:!0,side:a.DoubleSide,blending:a.AdditiveBlending});const f=[0,s-Math.PI/2,0],{model:{bounding:{max:{x:m,z:v},min:{x:g,y:y,z:x}}}}=e;r.yBase=y;return((e,{scale:t,rotation:n,position:i})=>{if(t&&e.scale.set(t,t,t),n){const[t,i,r]=n;t&&e.applyMatrix4(Jf(t,0,0)),i&&e.applyMatrix4(Jf(0,i,0)),r&&e.applyMatrix4(Jf(0,0,r))}i&&e.position.set(i.x,i.y,i.z)})(d,{position:{x:(m+g)/2,y:y-1.6,z:(v+x)/2},rotation:f,scale:.0045*u}),r.object=d,!0},disable:()=>{r.object&&(e.scene.remove(r.object),e.needsRender=!0,e.off("cameraDirectionUpdate",o))},enable:()=>{if(!r.object)return;const t=s(e.getPose().latitude);t&&(r.object.position.y=t),e.scene.add(r.object),e.needsRender=!0,e.on("cameraDirectionUpdate",o)}}},e.ModelEntryDoorGuidePlugin=(e,n)=>{var i,r,o;const s={},c=null==(i=n.animationEnabled)||i,h=null!=(r=n.position)?r:void 0,u=null!=(o=n.rad)?o:void 0,p=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",d=[],f=()=>{if(s.animation)return;if(!s.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",s.object);const n=new t.AnimationMixer(s.object);d.push(n);const i=n.clipAction(s.object.animations[0]);let r;i.timeScale=1;const o={play:()=>{r||(i.play(),r=(()=>{let t=0,n=0;const i=r=>{t=requestAnimationFrame(i);const o=r-n;o<33.333333333333336||(n=r,d.forEach((e=>e.update(o/1e3))),e.needsRender=!0)};return t=requestAnimationFrame(i),()=>{cancelAnimationFrame(t)}})(),requestAnimationFrame((()=>{s.object&&s.object.rotation.z!==s.rad&&(s.object.rotation.z=s.rad)})))},stop:()=>{i.stop(),null==r||r(),r=void 0}};s.animation=o},m=t=>{var n;if(!s.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",s.object);(null!=(n=null==t?void 0:t.animationEnable)?n:c)&&(s.animation||f(),s.animation.play()),e.scene.add(s.object),e.needsRender=!0},v=t=>"Floorplan"===t?m():void(s.object&&(s.animation&&s.animation.stop(),e.scene.remove(s.object),e.needsRender=!0));return{load:async e=>{var n,i,r,o,c,d,f;const m=null!=(n=null==e?void 0:e.position)?n:h;if(!m)return Promise.reject("ModelEntryDoorGuidePlugin.load(): position is undefined");const v=l(m),g=null!=(i=null==e?void 0:e.rad)?i:u,y=null!=(r=null==e?void 0:e.fbx_url)?r:p;if(s.rad=g,void 0===g)return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${g}`);const x=await(new Zf).loadAsync(y);x.position.copy(v),x.rotation.z=g,x.scale.set(.8,.8,.8),Kf(x,{transparent:!0,side:a.DoubleSide});const b=null==(f=null==(d=null==(c=null==(o=x.children)?void 0:o[0])?void 0:c.children)?void 0:d[3])?void 0:f.clone();return b?(b.material=new t.MeshBasicMaterial({transparent:!0,map:$f("入户门")}),b.renderOrder=3,x.children[0].add(b),s.object=x,!0):Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${b}`)},enable:t=>(s.enabled||(s.enabled=!0,v(e.currentMode),e.on("modeChange",v),m(t)),!0),disable:()=>!s.enabled||(s.enabled=!1,e.off("modeChange",v),!0)}},e.ModelFloorplanPlugin=(e,t)=>new Jn(e,t),e.ModelRoomLabelPlugin=e=>new Be(e),e.ModelViewPlugin=e=>{let t=!0;const n=new a.Scene,i=new a.PerspectiveCamera(60,1,.1,1e3);let r=new a.Object3D;{const e=new a.DirectionalLight(16777215,.5);e.position.copy(new a.Vector3(1,1,1)),n.add(e)}{const e=new a.DirectionalLight(16777215,.3);n.add(e)}{const e=new a.AmbientLight(16777215,.3);n.add(e)}n.add(r);let o=null;const s=(e={})=>{if(!o)return;const n=o.domElement.parentNode;if(n&&n.nodeName){const{width:t=n.offsetWidth,height:r=n.offsetHeight}=e;o.setSize(t,r),i.aspect=t/r,i.updateProjectionMatrix()}t=!0},l=()=>{const{longitude:n,latitude:r}=e.getPose(),o=(()=>{const t=e.model.bounding,{fov:n,aspect:r}=i,o=Math.sqrt(Math.pow(t.max.x-t.min.x+2,2)+Math.pow(t.max.y-t.min.y+2,2)+Math.pow(t.max.z-t.min.z+2,2));let a=o/2/Math.tan(Math.PI*n/360);return r<1&&(a/=r),isNaN(a)?o:a})(),s=e.model.bounding.getCenter(new a.Vector3),l=o*Math.cos(r),c=new a.Vector3;c.x=Math.sin(n)*l+s.x,c.z=Math.cos(n)*l+s.z,c.y=Math.sin(r)*o+s.y,i.position.copy(c),i.lookAt(s),t=!0};return e.on("modelLoaded",(()=>{function t(e){return(e=e.clone()).uniforms.modelAlpha.value=1,e.uniforms.map.value&&(e.uniforms.map.value.needsUpdate=!0),e}n.remove(r),r=function e(n){if(n instanceof a.Mesh){const e=n.geometry,i=Array.isArray(n.material)?n.material.map(t):t(n.material);return new a.Mesh(e,i)}if(n instanceof a.Group){const t=new a.Group;return n.children.forEach((n=>t.add(e(n)))),t}{const t=new a.Object3D;return n.children.forEach((n=>t.add(e(n)))),t}}(e.model),n.add(r),l()})),e.on("modelWillLoad",(()=>{r.traverse((e=>{if(e instanceof a.Mesh){[].concat(e.material).forEach((e=>e.dispose()))}})),n.remove(r),r=new a.Object3D,n.add(r),l()})),e.on("cameraDirectionUpdate",l),e.on("dispose",(()=>{o&&o.dispose(),o=null})),e.on("renderFrame",(()=>{if(!0!==t)return;if(!o)return;if(!o.domElement.parentNode)return;0!==o.domElement.parentNode.offsetWidth&&(o.render(n,i),t=!1)})),{appendTo:(t,n={})=>{const i=(()=>{if(e.renderer)return o||(o=new a.WebGLRenderer({antialias:!1,alpha:!0}),o.setPixelRatio(e.renderer.getPixelRatio()),o.outputEncoding=a.sRGBEncoding,o.setClearColor(1579548,0),o.autoClear=!0),o})();if(!i)return;t.appendChild(i.domElement),s(n);const r=window.getComputedStyle(t).position;"relative"!==r&&"absolute"!==r&&"fixed"!==r&&"sticky"!==r&&(t.style.position="relative")},refresh:s}},e.PanoCompassPlugin=function(e,t){return new km(e,t)},e.PanoCursorRaycasterPlugin=e=>{const n={intersection:null,disposers:[]},i=e=>{n.intersection=e},r=()=>{n.intersection=null};e.on("modelLoaded",(()=>{e.on("intersectionOnModelUpdate",i),e.on("intersectionHidden",r)})),e.on("dispose",(()=>{e.off("intersectionOnModelUpdate",i),e.off("intersectionHidden",r)}));const o=()=>{var t,o;null==(o=null==(t=n.disposers)?void 0:t.forEach)||o.call(t,(e=>null==e?void 0:e())),e.off("intersectionOnModelUpdate",i),e.off("intersectionHidden",r)},a=(t,n)=>{const i=t.clone();return e.camera.position.clone().sub(i).setLength(n).add(i)};return{intersection:()=>n.intersection,pointAxesHelper:(i,r=2,o=.1)=>{const s=r/2,l=a(i,o),c=new t.Group;c.add(h(new t.Vector3(l.x+s,l.y,l.z),new t.Vector3(l.x-s,l.y,l.z),new t.Vector3(1,0,0)),h(new t.Vector3(l.x,l.y+s,l.z),new t.Vector3(l.x,l.y-s,l.z),new t.Vector3(0,1,0)),h(new t.Vector3(l.x,l.y,l.z+s),new t.Vector3(l.x,l.y,l.z-s),new t.Vector3(0,0,1))),e.scene.add(c),e.needsRender=!0;const u=()=>{e.scene.remove(c)};return n.disposers.push(u),{clear:u,pointAxesHelperMesh:c}},movePointTowardsCamera:a,destroy:o,dispose:o,canSeePoint:(n,i=0)=>{var r,o;const a=null==(r=null==e?void 0:e.camera)?void 0:r.position;if(!a)return!1;const s=n.distanceTo(a),l=n.sub(a).normalize(),c=new t.Raycaster(a,l),h=null==(o=e.model.intersectRaycaster(c))?void 0:o[0];return!(h&&h.distance+i<s)}}},e.PanoFloorplanRadarPlugin=(e,t)=>new Un(e,t),e.PanoMeasurePlugin=function(e,t){return new zv(e,t)},e.PanoRulerPlugin=(e,n)=>{const i={enable:!1,loaded:!1,options:n.options||{distanceText:e=>`${e.toFixed(1)}m`}},o=(e,t)=>{const n=`\n <div class="PanoRulerPlugin-rule-line">\n <em></em>\n <div class="PanoRulerPlugin-rule-label">\n <div class="PanoRulerPlugin-rule-label-name">${i.options.distanceText(t)}</div>\n </div>\n </div>\n `,r=document.createElement("div");return r.setAttribute("class","PanoRulerPlugin-rule"),r.setAttribute("data-name",e),r.setAttribute("style","display: none"),r.innerHTML=n,r},a=document.createElement("div");a.setAttribute("style","position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;");const s=document.createElement("div");s.innerHTML="<style type=\"text/css\">\n.PanoRulerPlugin-rule-line {\n position: absolute;\n transform-origin: left center;\n width: 0;\n height: 0.0625rem;\n}\n\n.PanoRulerPlugin-rule-line::after {\n content: '';\n position: absolute;\n left: -0.125rem;\n top: -0.1rem;\n width: 0.25rem;\n height: 0.25rem;\n border-radius: 50%;\n background: #FFFFFF;\n z-index: 1;\n animation: viewport-rule-point 0.1s 1s;\n animation-fill-mode: both;\n}\n\n.PanoRulerPlugin-rule-line::before {\n content: '';\n position: absolute;\n right: -0.125rem;\n top: -0.1rem;\n width: 0.25rem;\n height: 0.25rem;\n border-radius: 50%;\n background: #FFFFFF;\n animation: viewport-rule-point 0.1s 1.5s;\n animation-fill-mode: both;\n}\n\n.PanoRulerPlugin-rule-line em {\n background: #fff;\n display: block;\n height: 100%;\n animation: viewport-rule-line 0.5s ease 1s;\n animation-fill-mode: both;\n box-shadow: 0 0 0.25rem rgb(0 0 0 / 40%);\n}\n\n.PanoRulerPlugin-rule-label {\n position: absolute;\n width: 0;\n height: 0;\n top: 0.0625rem;\n}\n\n.PanoRulerPlugin-rule-label-name {\n position: absolute;\n padding: 0.1875rem 0.375rem;\n background: rgba(195,195,195,0.30);\n backdrop-filter: blur(0.25rem);\n -webkit-backdrop-filter: blur(0.25rem);\n border-radius: 6.25rem;\n border: 0.0625rem solid rgba(255,255,255,0.6);\n white-space: nowrap;\n overflow: hidden;\n color: #FFFFFF;\n font-weight: 500;\n font-size: 0.75rem;\n line-height: 1;\n -webkit-animation: viewport-rule-label 0.25s ease 1s;\n animation: viewport-rule-label 0.25s ease 1s;\n animation-fill-mode: both;\n box-shadow: inset 0 0 0.625rem 0 rgba(255,255,255,0.30);\n}\n\n@keyframes viewport-rule-line {\n 0% { width: 0% }\n 100% { width: 100% }\n}\n\n@keyframes viewport-rule-label {\n 0% { opacity: 0; transform: scaleX(0); }\n 100% { opacity: 1; transform: translate(-50%, -50%) scaleX(1); }\n}\n\n@keyframes viewport-rule-point {\n 0% { transform: scaleX(0); }\n 100% { transform: scaleX(1); }\n}\n</style>\n",a.appendChild(s);const l={},c=(n,r)=>{if(i.loaded)throw new Error("标尺被重复初始化!");const s=((e,n)=>{const i={},r=new t.Raycaster,o=n.work;if(!o)return i;const a=e.observers;o.observers.forEach(((o,s)=>{const{standingPosition:l}=o,c=new t.Vector3(l.x,l.y,l.z);r.set(c,new t.Vector3(0,1,0));const[h]=n.model.intersectRaycaster(r),u=h?h.point.y:2.7,p=a[s];if(!p)return i;const d=e.rooms[p].name;void 0===i[d]?i[d]={__roof:[u],__floor:[c.y]}:(i[d].__roof.push(u),i[d].__floor.push(c.y))}));for(const t in i){const e=i[t];e.__roof.sort(),e.__floor.sort(),e.floor=e.__floor[~~(e.__floor.length/2)],e.roof=e.__roof[e.__roof.length-1]}return i})(n,e),c=e.work;if(!c)return!1;for(const e in r){const i=r[e],{standingPosition:h}=c.observers[0],u=i.map((({x:e,z:i,observers:r})=>{const o=r.length>0?n.rooms[n.observers[r[0]]].name:"",a=s[o]?s[o].floor:null;let l=1/0,u={index:0,x:h.x,y:h.y,z:h.z};r.forEach((t=>{if(!c.observers[t])return;const{standingPosition:n}=c.observers[t],r={index:t,x:n.x,y:n.y,z:n.z},o=(s={x:e,z:i},h=r,Math.sqrt(Math.pow(s.z-h.z,2)+Math.pow(s.x-h.x,2)));var s,h;a?o<l&&Math.abs(r.y-a)<.3&&(l=o,u=r):o<l&&(l=o,u=r)}));const p=new t.Vector3(e,u.y,i);Object.assign(p,{observers:r});const d=s[o]?s[o].roof:null,f=d?new t.Vector3(e,d,i):null;f&&Object.assign(f,{observers:r});return{origin:p,vertical:f}}));l[e]={origins:u.map((e=>e.origin)),rules:[]};for(const{origin:t,vertical:n}of u){if(!n)continue;const i=o(e,t.distanceTo(n));a.append(i),l[e].rules.push({vertical:!0,rule:[t,n],$element:i})}for(let t=0;t<u.length;t++){let n=t+1;n>=u.length&&(n=0);const{origin:i}=u[t],{origin:r}=u[n],s=o(e,i.distanceTo(r));a.append(s),l[e].rules.push({vertical:!1,rule:[i,r],$element:s})}}return i.loaded=!0,!0},h=async(t,r,o)=>{const a=t||n.roomInfo,s=r||n.roomRules;if(!a||!s)throw new Error("标尺数据依赖不齐全!");return i.options=Object.assign({},i.options,o||{}),e.model.loaded?c(a,s):await new Promise((t=>e.once("modelLoaded",(()=>t(c(a,s))))))};n.roomInfo&&n.roomRules&&h(n.roomInfo,n.roomRules);const u=(e,t,n,i)=>{const r=[[{x:0,y:0},{x:n,y:0}],[{x:0,y:0},{x:0,y:i}],[{x:n,y:0},{x:n,y:i}],[{x:0,y:i},{x:n,y:i}]],o=[];for(let a=0;a<r.length;a++){const n=Im([e,t],[r[a][0],r[a][1]],!0);n&&o.push(n)}return 0!==o.length&&o},p=()=>{var n;const o=null==(n=e.getElement())?void 0:n.parentElement;if(!o)return;if(!i.loaded)return;if(Object.keys(l).length<=0)return;const{panoIndex:a,camera:s,currentMode:c}=e;if(void 0===a)return;let h;for(const e in l)e.split(",").indexOf(a.toString())>=0&&(h=e);if(!h)return;const p=s.position,d=s.getWorldDirection(new t.Vector3),f=o.clientWidth,m=o.clientHeight;if(c!==r.Five.Mode.Panorama){for(const e in l)for(const{$element:t}of l[e].rules)t.style.display="none";return}for(const e in l)for(const{$element:t}of l[e].rules)t.style.display=e===h?"block":"none";const[v]=l[h].origins.slice().filter((e=>e.observers.indexOf(a)>=0)).sort(((e,t)=>e.clone().setY(0).sub(p).normalize().angleTo(d.clone().setY(0))-t.clone().setY(0).sub(p).normalize().angleTo(d.clone().setY(0))));for(const{rule:e,vertical:i,$element:r}of l[h].rules){const[n,i]=e,o=r.querySelector(".PanoRulerPlugin-rule-line");if(!o)return;if(!v){r.style.display="none";continue}if(n!==v&&i!==v){r.style.display="none";continue}if(n.distanceTo(i)<.5){r.style.display="none";continue}if(-1===n.observers.indexOf(a)||-1===i.observers.indexOf(a)){r.style.display="none";continue}if(n.clone().sub(p).normalize().angleTo(d)>Math.PI/2){r.style.display="none";continue}if(i.clone().sub(p).normalize().angleTo(d)>Math.PI/2){r.style.display="none";continue}const l=n.distanceTo(i);if(i.clone().sub(i.clone().sub(n).divide(new t.Vector3(2,2,2))).distanceTo(p)/l>8){r.style.display="none";continue}const c=n.clone().project(s),h=(c.x+1)/2*f,g=(1-c.y)/2*m,y=i.clone().project(s),x=(y.x+1)/2*f,b=(1-y.y)/2*m,w=Math.sqrt(Math.pow(x-h,2)+Math.pow(b-g,2));let _=w,M=50;const E=u({x:~~h,y:~~g},{x:~~x,y:~~b},f,m);if(E&&1===E.length&&(v===n?(_=Math.sqrt(Math.pow(E[0].x-h,2)+Math.pow(E[0].y-g,2)),M=_/w*50):v===i&&(_=Math.sqrt(Math.pow(E[0].x-x,2)+Math.pow(E[0].y-b,2)),M=100-_/w*50)),E&&2===E.length){const e={x:(E[0].x+E[1].x)/2,y:(E[0].y+E[1].y)/2};M=Math.sqrt(Math.pow(e.x-h,2)+Math.pow(e.y-g,2))/w*100}const S=(Math.PI/2-Math.atan2(x-h,g-b))/Math.PI*180,A=o.querySelector(".PanoRulerPlugin-rule-label"),T=A.children[0].clientWidth;T>=w||T/2>=M/100*w||T/2>=(1-M/100)*w?o.style.display="none":(o.style.display="block",o.style.width=w+"px",o.style.left=h+"px",o.style.top=g+"px",o.style.transform=`rotate(${-S}deg)`,A.style.left=`${M}%`)}},d=()=>Dm(p),f=En(p,80);return{enable:()=>{var t,n;return!!i.loaded&&(i.enable||(a.setAttribute("class","PanoRulerPlugin"+(i.options.className?" "+i.options.className:"")),null==(n=null==(t=e.getElement())?void 0:t.parentElement)||n.append(a),p(),e.on("panoArrived",p),e.on("modeChange",p),e.on("cameraDirectionUpdate",d),e.on("movingToPano",d),e.on("mouseWheel",f),e.on("pinchGesture",f),i.enable=!0),!0)},disable:()=>!i.enable||(e.off("panoArrived",p),e.off("modeChange",p),e.off("cameraDirectionUpdate",d),e.off("movingToPano",d),e.off("mouseWheel",f),e.off("pinchGesture",f),a&&a.remove(),i.enable=!1,!0),load:h,state:i}},e.TopviewFloorplanPlugin=(e,t)=>new Mn(e,t),Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));